@@ -52,9 +52,7 @@ pub fn generate_service_router(
5252 // Generate Layer 2: HTTP adapter functions (gleam/http types)
5353 let http_adapters =
5454 list . filter ( methods , has_http_annotation )
55- |> list . map ( fn ( method ) {
56- generate_http_adapter ( method , service . name )
57- } )
55+ |> list . map ( fn ( method ) { generate_http_adapter ( method , service . name ) } )
5856 |> string . join ( "\n \n " )
5957
6058 // Generate error types and converters
@@ -118,9 +116,7 @@ fn generate_service_function(method: Method, service_name: String) -> String {
118116 [
119117 "/// Service function for " <> method . name ,
120118 "/// Handles protobuf encoding/decoding, returns encoded response or error" ,
121- "pub fn "
122- <> function_name
123- <> "(" ,
119+ "pub fn " <> function_name <> "(" ,
124120 " request_bytes: BitArray," ,
125121 " handler: fn("
126122 <> request_type
@@ -177,9 +173,7 @@ fn generate_http_adapter(method: Method, service_name: String) -> String {
177173 string . join (
178174 [
179175 " let request_bytes = req.body" ,
180- " case "
181- <> service_function_name
182- <> "(request_bytes, handler) {" ,
176+ " case " <> service_function_name <> "(request_bytes, handler) {" ,
183177 " Ok(response_bytes) -> {" ,
184178 " response.Response(" ,
185179 " status: 200," ,
@@ -240,9 +234,7 @@ fn generate_http_adapter(method: Method, service_name: String) -> String {
240234 "/// HTTP adapter for " <> method . name ,
241235 "/// " <> http_method_str <> " " <> path ,
242236 "/// Uses gleam/http types (server-agnostic)" ,
243- "pub fn "
244- <> function_name
245- <> "(" ,
237+ "pub fn " <> function_name <> "(" ,
246238 " req: request.Request(BitArray)," ,
247239 " handler: fn("
248240 <> request_type
@@ -737,19 +729,20 @@ fn analyze_needed_helpers(
737729 messages : List ( Message ) ,
738730) -> NeededHelpers {
739731 // Start with all helpers disabled
740- let initial = NeededHelpers (
741- path_extraction : False ,
742- path_string : False ,
743- path_int : False ,
744- query_string : False ,
745- query_int : False ,
746- query_bool : False ,
747- query_float : False ,
748- query_list_string : False ,
749- query_list_int : False ,
750- query_optional_string : False ,
751- query_optional_int : False ,
752- )
732+ let initial =
733+ NeededHelpers (
734+ path_extraction : False ,
735+ path_string : False ,
736+ path_int : False ,
737+ query_string : False ,
738+ query_int : False ,
739+ query_bool : False ,
740+ query_float : False ,
741+ query_list_string : False ,
742+ query_list_int : False ,
743+ query_optional_string : False ,
744+ query_optional_int : False ,
745+ )
753746
754747 // Analyze each method that uses GET/DELETE (query/path params)
755748 list . fold ( service . methods , initial , fn ( acc , method ) {
@@ -768,12 +761,18 @@ fn analyze_needed_helpers(
768761 // Analyze each field
769762 list . fold ( message . fields , acc , fn ( field_acc , field ) {
770763 let field_name_lower = string . lowercase ( field . name )
771- let is_path_param = list . any ( path_params , fn ( param ) {
772- string . lowercase ( param ) == field_name_lower
773- } )
764+ let is_path_param =
765+ list . any ( path_params , fn ( param ) {
766+ string . lowercase ( param ) == field_name_lower
767+ } )
774768
775769 case is_path_param {
776- True -> analyze_path_param_type ( field . field_type , field_acc , has_path_params )
770+ True ->
771+ analyze_path_param_type (
772+ field . field_type ,
773+ field_acc ,
774+ has_path_params ,
775+ )
777776 False -> analyze_query_param_type ( field . field_type , field_acc )
778777 }
779778 } )
@@ -1355,4 +1354,3 @@ fn generate_query_param_helpers() -> String {
13551354 "\n " ,
13561355 )
13571356}
1358-
0 commit comments