-module(oaspec@internal@codegen@server_request_decode). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/oaspec/internal/codegen/server_request_decode.gleam"). -export([body_field_kind_needs_int/1, body_field_kind_needs_float/1, param_needs_result_unwrap/1, schema_ref_string_enum/2, operations_have_enum_ref_params/2, enum_match_result_expr/3, is_deep_object_param/2, deep_object_has_additional_properties/2, deep_object_param_has_optional_fields/2, request_body_uses_form_urlencoded/1, request_body_uses_multipart/1, operation_uses_form_urlencoded_body/1, operation_uses_multipart_body/1, operation_uses_octet_stream_body/1, deep_object_has_untyped_additional_properties/2, form_urlencoded_body_has_nested_object/2, multipart_body_has_optional_fields/2, form_urlencoded_body_has_optional_fields/2, query_schema_needs_string/1, deep_object_param_needs_string/2, form_urlencoded_body_needs_string/2, query_schema_needs_int/1, deep_object_param_needs_int/2, query_schema_needs_float/1, deep_object_param_needs_float/2, param_parse_expr/2, query_required_expr/3, query_optional_expr/3, deep_object_required_expr/4, deep_object_optional_expr/4, header_required_expr/2, cookie_required_expr/2, header_optional_expr/2, cookie_optional_expr/2, body_field_kind/2, schema_ref_body_field_kind/2, multipart_body_needs_int/2, multipart_body_needs_float/2, form_urlencoded_body_needs_int/2, form_urlencoded_body_needs_float/2, generate_body_decode_expr/3]). -export_type([deep_object_property/0, body_field_kind/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(false). -type deep_object_property() :: {deep_object_property, binary(), binary(), oaspec@internal@openapi@schema:schema_ref(), boolean()}. -type body_field_kind() :: body_field_unknown | body_field_string | body_field_int | body_field_float | body_field_bool | body_field_string_array | body_field_int_array | body_field_float_array | body_field_bool_array. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 98). ?DOC(false). -spec body_field_kind_needs_int(body_field_kind()) -> boolean(). body_field_kind_needs_int(Kind) -> case Kind of body_field_int -> true; body_field_int_array -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 105). ?DOC(false). -spec body_field_kind_needs_float(body_field_kind()) -> boolean(). body_field_kind_needs_float(Kind) -> case Kind of body_field_float -> true; body_field_float_array -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 136). ?DOC(false). -spec param_needs_result_unwrap( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). param_needs_result_unwrap(Param) -> case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> true; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 304). ?DOC(false). -spec schema_ref_string_enum( oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context() ) -> gleam@option:option({binary(), list(binary())}). schema_ref_string_enum(Schema_ref, Ctx) -> case Schema_ref of {reference, _, Ref_name} -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref, Ctx ) of {ok, {string_schema, _, _, Values, _, _, _}} -> case Values of [_ | _] -> {some, {oaspec@internal@util@naming:schema_to_type_name( Ref_name ), Values}}; [] -> none end; _ -> none end; _ -> none end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 347). ?DOC(false). -spec parameter_is_enum_ref( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). parameter_is_enum_ref(P, Ctx) -> case {erlang:element(3, P), oaspec@internal@openapi@spec:parameter_schema(P)} of {in_query, {some, S}} -> case schema_ref_string_enum(S, Ctx) of {some, _} -> true; none -> false end; {in_header, {some, S}} -> case schema_ref_string_enum(S, Ctx) of {some, _} -> true; none -> false end; {in_cookie, {some, S}} -> case schema_ref_string_enum(S, Ctx) of {some, _} -> true; none -> false end; {_, _} -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 332). ?DOC(false). -spec operations_have_enum_ref_params( list({binary(), oaspec@internal@openapi@spec:operation(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@openapi@spec:http_method()}), oaspec@internal@codegen@context:context() ) -> boolean(). operations_have_enum_ref_params(Operations, Ctx) -> gleam@list:any( Operations, fun(Op) -> {_, Operation, _, _} = Op, gleam@list:any( erlang:element(6, Operation), fun(Ref_p) -> case Ref_p of {value, P} -> parameter_is_enum_ref(P, Ctx); _ -> false end end ) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 362). ?DOC(false). -spec enum_match_result_expr(binary(), binary(), list(binary())) -> binary(). enum_match_result_expr(Bound_var, Type_name, Values) -> Arms = begin _pipe = Values, _pipe@1 = gleam@list:map( _pipe, fun(V) -> <<<<<<<<<<"\""/utf8, V/binary>>/binary, "\" -> Ok(types."/utf8>>/binary, Type_name/binary>>/binary, (oaspec@internal@util@naming:to_pascal_case(V))/binary>>/binary, ")"/utf8>> end ), gleam@string:join(_pipe@1, <<" "/utf8>>) end, <<<<<<<<"case "/utf8, Bound_var/binary>>/binary, " { "/utf8>>/binary, Arms/binary>>/binary, " _ -> Error(Nil) }"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 385). ?DOC(false). -spec enum_match_option_expr(binary(), binary(), list(binary())) -> binary(). enum_match_option_expr(V_var, Type_name, Values) -> Arms = begin _pipe = Values, _pipe@1 = gleam@list:map( _pipe, fun(V) -> <<<<<<<<<<"\""/utf8, V/binary>>/binary, "\" -> Some(types."/utf8>>/binary, Type_name/binary>>/binary, (oaspec@internal@util@naming:to_pascal_case(V))/binary>>/binary, ")"/utf8>> end ), gleam@string:join(_pipe@1, <<" "/utf8>>) end, <<<<<<<<"case "/utf8, V_var/binary>>/binary, " { "/utf8>>/binary, Arms/binary>>/binary, " _ -> None }"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 508). ?DOC(false). -spec is_deep_object_param( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). is_deep_object_param(Param, Ctx) -> oaspec@internal@codegen@operation_ir:is_deep_object_param(Param, Ctx). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 515). ?DOC(false). -spec deep_object_properties( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> list(deep_object_property()). deep_object_properties(Param, Ctx) -> Details = case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, {reference, _, _} = Schema_ref} -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref, Ctx ) of {ok, {object_schema, _, Properties, Required, _, _, _}} -> {Properties, Required}; _ -> {maps:new(), []} end; {some, {inline, {object_schema, _, Properties@1, Required@1, _, _, _}}} -> {Properties@1, Required@1}; _ -> {maps:new(), []} end, {Properties@2, Required_fields} = Details, _pipe = oaspec@internal@codegen@ir_build:sorted_entries(Properties@2), gleam@list:map( _pipe, fun(Entry) -> {Prop_name, Prop_ref} = Entry, {deep_object_property, Prop_name, oaspec@internal@util@naming:to_snake_case(Prop_name), Prop_ref, gleam@list:contains(Required_fields, Prop_name)} end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 544). ?DOC(false). -spec deep_object_type_name( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), binary() ) -> binary(). deep_object_type_name(Param, Op_id) -> case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, {reference, _, Name}} -> <<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name(Name))/binary>>; _ -> <<<<<<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name(Op_id))/binary>>/binary, "Param"/utf8>>/binary, (oaspec@internal@util@naming:to_pascal_case( erlang:element(2, Param) ))/binary>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 652). ?DOC(false). -spec deep_object_has_additional_properties( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). deep_object_has_additional_properties(Param, Ctx) -> case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, {reference, _, _} = Schema_ref} -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref, Ctx ) of {ok, {object_schema, _, _, _, {typed, _}, _, _}} -> true; {ok, {object_schema, _, _, _, untyped, _, _}} -> true; _ -> false end; {some, {inline, {object_schema, _, _, _, {typed, _}, _, _}}} -> true; {some, {inline, {object_schema, _, _, _, untyped, _, _}}} -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 685). ?DOC(false). -spec deep_object_param_has_optional_fields( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). deep_object_param_has_optional_fields(Param, Ctx) -> gleam@bool:guard( not is_deep_object_param(Param, Ctx), false, fun() -> gleam@list:any( deep_object_properties(Param, Ctx), fun(Prop) -> not erlang:element(5, Prop) end ) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 720). ?DOC(false). -spec deep_object_param_needs( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context(), fun((deep_object_property()) -> boolean()) ) -> boolean(). deep_object_param_needs(Param, Ctx, Predicate) -> gleam@bool:guard( not is_deep_object_param(Param, Ctx), false, fun() -> gleam@list:any(deep_object_properties(Param, Ctx), Predicate) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 729). ?DOC(false). -spec request_body_uses_form_urlencoded( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). request_body_uses_form_urlencoded(Rb) -> gleam@dict:has_key( erlang:element(3, Rb), <<"application/x-www-form-urlencoded"/utf8>> ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 733). ?DOC(false). -spec request_body_uses_multipart( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). request_body_uses_multipart(Rb) -> gleam@dict:has_key(erlang:element(3, Rb), <<"multipart/form-data"/utf8>>). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 741). ?DOC(false). -spec request_body_uses_octet_stream( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). request_body_uses_octet_stream(Rb) -> gleam@dict:has_key( erlang:element(3, Rb), <<"application/octet-stream"/utf8>> ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 745). ?DOC(false). -spec operation_uses_form_urlencoded_body( oaspec@internal@openapi@spec:operation(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). operation_uses_form_urlencoded_body(Operation) -> case erlang:element(7, Operation) of {some, {value, Rb}} -> request_body_uses_form_urlencoded(Rb); _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 754). ?DOC(false). -spec operation_uses_multipart_body( oaspec@internal@openapi@spec:operation(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). operation_uses_multipart_body(Operation) -> case erlang:element(7, Operation) of {some, {value, Rb}} -> request_body_uses_multipart(Rb); _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 763). ?DOC(false). -spec operation_uses_octet_stream_body( oaspec@internal@openapi@spec:operation(oaspec@internal@openapi@spec:resolved()) ) -> boolean(). operation_uses_octet_stream_body(Operation) -> case erlang:element(7, Operation) of {some, {value, Rb}} -> request_body_uses_octet_stream(Rb); _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 772). ?DOC(false). -spec object_properties_from_schema_ref( oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context() ) -> list(deep_object_property()). object_properties_from_schema_ref(Schema_ref, Ctx) -> Details = case Schema_ref of {reference, _, _} = Schema_ref@1 -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref@1, Ctx ) of {ok, {object_schema, _, Properties, Required, _, _, _}} -> {Properties, Required}; _ -> {maps:new(), []} end; {inline, {object_schema, _, Properties@1, Required@1, _, _, _}} -> {Properties@1, Required@1}; _ -> {maps:new(), []} end, {Properties@2, Required_fields} = Details, _pipe = oaspec@internal@codegen@ir_build:sorted_entries(Properties@2), gleam@list:map( _pipe, fun(Entry) -> {Prop_name, Prop_ref} = Entry, {deep_object_property, Prop_name, oaspec@internal@util@naming:to_snake_case(Prop_name), Prop_ref, gleam@list:contains(Required_fields, Prop_name)} end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 798). ?DOC(false). -spec form_urlencoded_body_properties( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> list(deep_object_property()). form_urlencoded_body_properties(Rb, Ctx) -> case gleam_stdlib:map_get( erlang:element(3, Rb), <<"application/x-www-form-urlencoded"/utf8>> ) of {ok, Media_type} -> case erlang:element(2, Media_type) of {some, Schema_ref} -> object_properties_from_schema_ref(Schema_ref, Ctx); none -> [] end; {error, _} -> [] end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 814). ?DOC(false). -spec multipart_body_properties( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> list(deep_object_property()). multipart_body_properties(Rb, Ctx) -> case gleam_stdlib:map_get( erlang:element(3, Rb), <<"multipart/form-data"/utf8>> ) of {ok, Media_type} -> case erlang:element(2, Media_type) of {some, Schema_ref} -> object_properties_from_schema_ref(Schema_ref, Ctx); none -> [] end; {error, _} -> [] end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 829). ?DOC(false). -spec schema_ref_resolves_to_object( oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context() ) -> boolean(). schema_ref_resolves_to_object(Schema_ref, Ctx) -> case Schema_ref of {inline, {object_schema, _, _, _, _, _, _}} -> true; {reference, _, _} = Schema_ref@1 -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref@1, Ctx ) of {ok, {object_schema, _, _, _, _, _, _}} -> true; _ -> false end; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 841). ?DOC(false). -spec schema_ref_additional_properties( oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context() ) -> oaspec@internal@openapi@schema:additional_properties(). schema_ref_additional_properties(Schema_ref, Ctx) -> case Schema_ref of {inline, {object_schema, _, _, _, Additional_properties, _, _}} -> Additional_properties; {reference, _, _} = Schema_ref@1 -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref@1, Ctx ) of {ok, {object_schema, _, _, _, Additional_properties@1, _, _}} -> Additional_properties@1; _ -> forbidden end; _ -> forbidden end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 671). ?DOC(false). -spec deep_object_has_untyped_additional_properties( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). deep_object_has_untyped_additional_properties(Param, Ctx) -> case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, Schema_ref} -> case schema_ref_additional_properties(Schema_ref, Ctx) of untyped -> true; _ -> false end; none -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 856). ?DOC(false). -spec body_additional_properties( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> oaspec@internal@openapi@schema:additional_properties(). body_additional_properties(Rb, Content_type, Ctx) -> case gleam_stdlib:map_get(erlang:element(3, Rb), Content_type) of {ok, Media_type} -> case erlang:element(2, Media_type) of {some, Schema_ref} -> schema_ref_additional_properties(Schema_ref, Ctx); none -> forbidden end; {error, _} -> forbidden end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 872). ?DOC(false). -spec form_urlencoded_schema_ref_type_name( oaspec@internal@openapi@schema:schema_ref() ) -> binary(). form_urlencoded_schema_ref_type_name(Schema_ref) -> case Schema_ref of {reference, _, Name} -> <<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name(Name))/binary>>; _ -> <<"String"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 879). ?DOC(false). -spec form_urlencoded_body_type_name( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), binary() ) -> binary(). form_urlencoded_body_type_name(Rb, Op_id) -> case gleam_stdlib:map_get( erlang:element(3, Rb), <<"application/x-www-form-urlencoded"/utf8>> ) of {ok, Media_type} -> case erlang:element(2, Media_type) of {some, {reference, _, Name}} -> <<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name(Name))/binary>>; {some, {inline, {object_schema, _, _, _, _, _, _}}} -> <<<<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name( Op_id ))/binary>>/binary, "Request"/utf8>>; _ -> <<"String"/utf8>> end; {error, _} -> <<"String"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 897). ?DOC(false). -spec multipart_body_type_name( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), binary() ) -> binary(). multipart_body_type_name(Rb, Op_id) -> case gleam_stdlib:map_get( erlang:element(3, Rb), <<"multipart/form-data"/utf8>> ) of {ok, Media_type} -> case erlang:element(2, Media_type) of {some, {reference, _, Name}} -> <<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name(Name))/binary>>; {some, {inline, {object_schema, _, _, _, _, _, _}}} -> <<<<"types."/utf8, (oaspec@internal@util@naming:schema_to_type_name( Op_id ))/binary>>/binary, "Request"/utf8>>; _ -> <<"String"/utf8>> end; {error, _} -> <<"String"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 915). ?DOC(false). -spec form_urlencoded_key(binary(), binary()) -> binary(). form_urlencoded_key(Prefix, Name) -> case Prefix of <<""/utf8>> -> Name; _ -> <<<<<>/binary, Name/binary>>/binary, "]"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1071). ?DOC(false). -spec form_urlencoded_body_has_nested_object( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). form_urlencoded_body_has_nested_object(Rb, Ctx) -> gleam@list:any( form_urlencoded_body_properties(Rb, Ctx), fun(Prop) -> schema_ref_resolves_to_object(erlang:element(4, Prop), Ctx) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1120). ?DOC(false). -spec multipart_body_has_optional_fields( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). multipart_body_has_optional_fields(Rb, Ctx) -> gleam@list:any( multipart_body_properties(Rb, Ctx), fun(Prop) -> not erlang:element(5, Prop) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1151). ?DOC(false). -spec form_urlencoded_properties_have_optional_fields( list(deep_object_property()), oaspec@internal@codegen@context:context(), boolean() ) -> boolean(). form_urlencoded_properties_have_optional_fields( Props, Ctx, Allow_nested_objects ) -> gleam@list:any( Props, fun(Prop) -> not erlang:element(5, Prop) orelse case Allow_nested_objects andalso schema_ref_resolves_to_object( erlang:element(4, Prop), Ctx ) of true -> form_urlencoded_properties_have_optional_fields( object_properties_from_schema_ref( erlang:element(4, Prop), Ctx ), Ctx, false ); false -> false end end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1027). ?DOC(false). -spec form_urlencoded_body_has_optional_fields( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). form_urlencoded_body_has_optional_fields(Rb, Ctx) -> form_urlencoded_properties_have_optional_fields( form_urlencoded_body_properties(Rb, Ctx), Ctx, true ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1209). ?DOC(false). -spec form_urlencoded_properties_need( list(deep_object_property()), oaspec@internal@codegen@context:context(), boolean(), fun((deep_object_property()) -> boolean()) ) -> boolean(). form_urlencoded_properties_need(Props, Ctx, Allow_nested_objects, Predicate) -> gleam@list:any( Props, fun(Prop) -> Predicate(Prop) orelse case Allow_nested_objects andalso schema_ref_resolves_to_object( erlang:element(4, Prop), Ctx ) of true -> form_urlencoded_properties_need( object_properties_from_schema_ref( erlang:element(4, Prop), Ctx ), Ctx, false, Predicate ); false -> false end end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1233). ?DOC(false). -spec query_schema_needs_string( gleam@option:option(oaspec@internal@openapi@schema:schema_ref()) ) -> boolean(). query_schema_needs_string(Schema_ref) -> case Schema_ref of {some, {inline, {array_schema, _, _, _, _, _}}} -> true; {some, {inline, {boolean_schema, _}}} -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 693). ?DOC(false). -spec deep_object_param_needs_string( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). deep_object_param_needs_string(Param, Ctx) -> deep_object_param_needs( Param, Ctx, fun(Prop) -> query_schema_needs_string({some, erlang:element(4, Prop)}) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1173). ?DOC(false). -spec form_urlencoded_properties_need_string( list(deep_object_property()), oaspec@internal@codegen@context:context(), boolean() ) -> boolean(). form_urlencoded_properties_need_string(Props, Ctx, Allow_nested_objects) -> form_urlencoded_properties_need( Props, Ctx, Allow_nested_objects, fun(Prop) -> query_schema_needs_string({some, erlang:element(4, Prop)}) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1038). ?DOC(false). -spec form_urlencoded_body_needs_string( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). form_urlencoded_body_needs_string(Rb, Ctx) -> form_urlencoded_properties_need_string( form_urlencoded_body_properties(Rb, Ctx), Ctx, true ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1241). ?DOC(false). -spec query_schema_needs_int( gleam@option:option(oaspec@internal@openapi@schema:schema_ref()) ) -> boolean(). query_schema_needs_int(Schema_ref) -> case Schema_ref of {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> true; {some, {inline, {array_schema, _, {inline, {integer_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 702). ?DOC(false). -spec deep_object_param_needs_int( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). deep_object_param_needs_int(Param, Ctx) -> deep_object_param_needs( Param, Ctx, fun(Prop) -> query_schema_needs_int({some, erlang:element(4, Prop)}) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1250). ?DOC(false). -spec query_schema_needs_float( gleam@option:option(oaspec@internal@openapi@schema:schema_ref()) ) -> boolean(). query_schema_needs_float(Schema_ref) -> case Schema_ref of {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> true; {some, {inline, {array_schema, _, {inline, {number_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> true; _ -> false end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 711). ?DOC(false). -spec deep_object_param_needs_float( oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). deep_object_param_needs_float(Param, Ctx) -> deep_object_param_needs( Param, Ctx, fun(Prop) -> query_schema_needs_float({some, erlang:element(4, Prop)}) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1297). ?DOC(false). -spec body_required_enum_expr(binary(), binary(), list(binary())) -> binary(). body_required_enum_expr(Lookup, Type_name, Values) -> Default = case Values of [First | _] -> <<<<"types."/utf8, Type_name/binary>>/binary, (oaspec@internal@util@naming:to_pascal_case(First))/binary>>; [] -> <<""/utf8>> end, Arms = begin _pipe = Values, _pipe@1 = gleam@list:map( _pipe, fun(V) -> <<<<<<<<"\""/utf8, V/binary>>/binary, "\" -> types."/utf8>>/binary, Type_name/binary>>/binary, (oaspec@internal@util@naming:to_pascal_case(V))/binary>> end ), gleam@string:join(_pipe@1, <<" "/utf8>>) end, <<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> case v { "/utf8>>/binary, Arms/binary>>/binary, " _ -> "/utf8>>/binary, Default/binary>>/binary, " } _ -> "/utf8>>/binary, Default/binary>>/binary, " }"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1327). ?DOC(false). -spec body_optional_enum_expr(binary(), binary(), binary(), list(binary())) -> binary(). body_optional_enum_expr(Lookup, Miss, Type_name, Values) -> <<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> "/utf8>>/binary, (enum_match_option_expr(<<"v"/utf8>>, Type_name, Values))/binary>>/binary, " "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1529). ?DOC(false). -spec array_item_int_parse(boolean()) -> binary(). array_item_int_parse(Trim) -> gleam@bool:guard( not Trim, <<"case int.parse(item) { Ok(n) -> n _ -> 0 }"/utf8>>, fun() -> <<"let trimmed = string.trim(item) case int.parse(trimmed) { Ok(n) -> n _ -> 0 }"/utf8>> end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1537). ?DOC(false). -spec array_item_float_parse(boolean()) -> binary(). array_item_float_parse(Trim) -> gleam@bool:guard( not Trim, <<"case float.parse(item) { Ok(n) -> n _ -> 0.0 }"/utf8>>, fun() -> <<"let trimmed = string.trim(item) case float.parse(trimmed) { Ok(n) -> n _ -> 0.0 }"/utf8>> end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 116). ?DOC(false). -spec param_parse_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()) ) -> binary(). param_parse_expr(Var_name, Param) -> case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> <<<<"int.parse("/utf8, Var_name/binary>>/binary, ")"/utf8>>; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> <<<<"float.parse("/utf8, Var_name/binary>>/binary, ")"/utf8>>; {some, {inline, {boolean_schema, _}}} -> <<<<<<<<"{ let v = "/utf8, Var_name/binary>>/binary, " "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " }"/utf8>>; _ -> Var_name end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 181). ?DOC(false). -spec deep_object_required_field_expr( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()) ) -> binary(). deep_object_required_field_expr(Key, Schema_ref) -> Base = <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> v _ -> \"\" }"/utf8>>, case Schema_ref of {some, {inline, {array_schema, _, {inline, {string_schema, _, _, _, _, _, _}}, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> list.map(vs, fn(item) { string.trim(item) }) _ -> [] }"/utf8>>; {some, {inline, {array_schema, _, {inline, {integer_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> list.map(vs, fn(item) { let trimmed = string.trim(item) case int.parse(trimmed) { Ok(n) -> n _ -> 0 } }) _ -> [] }"/utf8>>; {some, {inline, {array_schema, _, {inline, {number_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> list.map(vs, fn(item) { let trimmed = string.trim(item) case float.parse(trimmed) { Ok(n) -> n _ -> 0.0 } }) _ -> [] }"/utf8>>; {some, {inline, {array_schema, _, {inline, {boolean_schema, _}}, _, _, _}}} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> list.map(vs, fn(item) { let v = string.trim(item) "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " }) _ -> [] }"/utf8>>; {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> case int.parse(v) { Ok(n) -> n _ -> 0 } _ -> 0 }"/utf8>>; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> case float.parse(v) { Ok(n) -> n _ -> 0.0 } _ -> 0.0 }"/utf8>>; {some, {inline, {boolean_schema, _}}} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " _ -> False }"/utf8>>; _ -> Base end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 224). ?DOC(false). -spec query_required_expr_with_schema( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), gleam@option:option(boolean()), gleam@option:option(oaspec@internal@openapi@spec:parameter_style()), oaspec@internal@codegen@context:context() ) -> binary(). query_required_expr_with_schema(Bound_var, Schema_ref, Explode, Style, Ctx) -> Delim = oaspec@internal@codegen@operation_ir:delimiter_for_style(Style), case Schema_ref of {some, {inline, {array_schema, _, {inline, {string_schema, _, _, _, _, _, _}}, _, _, _}}} -> case Explode of {some, false} -> <<<<<<<<"list.map(string.split("/utf8, Bound_var/binary>>/binary, ", \""/utf8>>/binary, Delim/binary>>/binary, "\"), fn(item) { string.trim(item) })"/utf8>>; _ -> <<<<"list.map("/utf8, Bound_var/binary>>/binary, ", fn(item) { string.trim(item) })"/utf8>> end; {some, {inline, {array_schema, _, {inline, {integer_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <>; {some, {inline, {array_schema, _, {inline, {number_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <>; {some, {inline, {array_schema, _, {inline, {boolean_schema, _}}, _, _, _}}} -> case Explode of {some, false} -> <<<<<<<<<<<<"list.map(string.split("/utf8, Bound_var/binary>>/binary, ", \""/utf8>>/binary, Delim/binary>>/binary, "\"), fn(item) { let v = string.trim(item) "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " })"/utf8>>; _ -> <<<<<<<<"list.map("/utf8, Bound_var/binary>>/binary, ", fn(item) { let v = string.trim(item) "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " })"/utf8>> end; {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> <>; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> <>; {some, {inline, {boolean_schema, _}}} -> <<<<<<<<"{ let v = "/utf8, Bound_var/binary>>/binary, " "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " }"/utf8>>; {some, Ref} -> case schema_ref_string_enum(Ref, Ctx) of {some, _} -> <>; none -> Bound_var end; none -> Bound_var end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 160). ?DOC(false). -spec query_required_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> binary(). query_required_expr(Bound_var, Param, Ctx) -> query_required_expr_with_schema( Bound_var, oaspec@internal@openapi@spec:parameter_schema(Param), {some, oaspec@internal@codegen@operation_ir:effective_explode(Param)}, erlang:element(7, Param), Ctx ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 404). ?DOC(false). -spec query_optional_expr_with_schema( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), gleam@option:option(boolean()), gleam@option:option(oaspec@internal@openapi@spec:parameter_style()), oaspec@internal@codegen@context:context() ) -> binary(). query_optional_expr_with_schema(Key, Schema_ref, Explode, Style, Ctx) -> Delim = oaspec@internal@codegen@operation_ir:delimiter_for_style(Style), case Schema_ref of {some, {inline, {array_schema, _, {inline, {string_schema, _, _, _, _, _, _}}, _, _, _}}} -> case Explode of {some, false} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some(list.map(string.split(v, \""/utf8>>/binary, Delim/binary>>/binary, "\"), fn(item) { string.trim(item) })) _ -> None }"/utf8>>; _ -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> Some(list.map(vs, fn(item) { string.trim(item) })) _ -> None }"/utf8>> end; {some, {inline, {array_schema, _, {inline, {integer_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> case Explode of {some, false} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some(list.map(string.split(v, \""/utf8>>/binary, Delim/binary>>/binary, "\"), fn(item) { let trimmed = string.trim(item) case int.parse(trimmed) { Ok(n) -> n _ -> 0 } })) _ -> None }"/utf8>>; _ -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> Some(list.map(vs, fn(item) { let trimmed = string.trim(item) case int.parse(trimmed) { Ok(n) -> n _ -> 0 } })) _ -> None }"/utf8>> end; {some, {inline, {array_schema, _, {inline, {number_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> case Explode of {some, false} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some(list.map(string.split(v, \""/utf8>>/binary, Delim/binary>>/binary, "\"), fn(item) { let trimmed = string.trim(item) case float.parse(trimmed) { Ok(n) -> n _ -> 0.0 } })) _ -> None }"/utf8>>; _ -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> Some(list.map(vs, fn(item) { let trimmed = string.trim(item) case float.parse(trimmed) { Ok(n) -> n _ -> 0.0 } })) _ -> None }"/utf8>> end; {some, {inline, {array_schema, _, {inline, {boolean_schema, _}}, _, _, _}}} -> case Explode of {some, false} -> <<<<<<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some(list.map(string.split(v, \""/utf8>>/binary, Delim/binary>>/binary, "\"), fn(item) { let v = string.trim(item) "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " })) _ -> None }"/utf8>>; _ -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok(vs) -> Some(list.map(vs, fn(item) { let v = string.trim(item) "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " })) _ -> None }"/utf8>> end; {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> { case int.parse(v) { Ok(n) -> Some(n) _ -> None } } _ -> None }"/utf8>>; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> { case float.parse(v) { Ok(n) -> Some(n) _ -> None } } _ -> None }"/utf8>>; {some, {inline, {boolean_schema, _}}} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some("/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, ") _ -> None }"/utf8>>; {some, Ref} -> case schema_ref_string_enum(Ref, Ctx) of {some, {Type_name, Values}} -> <<<<<<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> "/utf8>>/binary, (enum_match_option_expr( <<"v"/utf8>>, Type_name, Values ))/binary>>/binary, " _ -> None }"/utf8>>; none -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some(v) _ -> None }"/utf8>> end; none -> <<<<"case dict.get(query, \""/utf8, Key/binary>>/binary, "\") { Ok([v, ..]) -> Some(v) _ -> None }"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 286). ?DOC(false). -spec query_optional_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> binary(). query_optional_expr(Key, Param, Ctx) -> query_optional_expr_with_schema( Key, oaspec@internal@openapi@spec:parameter_schema(Param), {some, oaspec@internal@codegen@operation_ir:effective_explode(Param)}, erlang:element(7, Param), Ctx ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 591). ?DOC(false). -spec deep_object_constructor_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> binary(). deep_object_constructor_expr(Key, Param, Op_id, Ctx) -> Fields = begin _pipe = deep_object_properties(Param, Ctx), gleam@list:map( _pipe, fun(Prop) -> Prop_key = <<<<<>/binary, (erlang:element(2, Prop))/binary>>/binary, "]"/utf8>>, Value_expr = case erlang:element(5, Prop) of true -> deep_object_required_field_expr( Prop_key, {some, erlang:element(4, Prop)} ); false -> query_optional_expr_with_schema( Prop_key, {some, erlang:element(4, Prop)}, {some, true}, none, Ctx ) end, <<<<(erlang:element(3, Prop))/binary, ": "/utf8>>/binary, Value_expr/binary>> end ) end, Ap_kind = case oaspec@internal@openapi@spec:parameter_schema(Param) of {some, Schema_ref} -> schema_ref_additional_properties(Schema_ref, Ctx); none -> forbidden end, Fields@1 = case Ap_kind of forbidden -> Fields; unspecified -> Fields; untyped -> Prop_names = begin _pipe@1 = deep_object_properties(Param, Ctx), _pipe@2 = gleam@list:map( _pipe@1, fun(Prop@1) -> <<<<"\""/utf8, (erlang:element(2, Prop@1))/binary>>/binary, "\""/utf8>> end ), gleam@string:join(_pipe@2, <<", "/utf8>>) end, Expr = <<<<<<<<"coerce_dict(deep_object_additional_properties(query, \""/utf8, Key/binary>>/binary, "\", ["/utf8>>/binary, Prop_names/binary>>/binary, "]))"/utf8>>, lists:append( Fields, [<<"additional_properties: "/utf8, Expr/binary>>] ); {typed, _} -> lists:append(Fields, [<<"additional_properties: dict.new()"/utf8>>]) end, Fields_str = gleam@string:join(Fields@1, <<", "/utf8>>), <<<<<<(deep_object_type_name(Param, Op_id))/binary, "("/utf8>>/binary, Fields_str/binary>>/binary, ")"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 558). ?DOC(false). -spec deep_object_required_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> binary(). deep_object_required_expr(Key, Param, Op_id, Ctx) -> deep_object_constructor_expr(Key, Param, Op_id, Ctx). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 567). ?DOC(false). -spec deep_object_optional_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> binary(). deep_object_optional_expr(Key, Param, Op_id, Ctx) -> Props = deep_object_properties(Param, Ctx), Prop_names = begin _pipe = Props, _pipe@1 = gleam@list:map( _pipe, fun(Prop) -> <<<<"\""/utf8, (erlang:element(2, Prop))/binary>>/binary, "\""/utf8>> end ), gleam@string:join(_pipe@1, <<", "/utf8>>) end, Has_untyped_ap = deep_object_has_untyped_additional_properties(Param, Ctx), Presence_check = case Has_untyped_ap of true -> <<<<"deep_object_present_any(query, \""/utf8, Key/binary>>/binary, "\")"/utf8>>; false -> <<<<<<<<"deep_object_present(query, \""/utf8, Key/binary>>/binary, "\", ["/utf8>>/binary, Prop_names/binary>>/binary, "])"/utf8>> end, <<<<<<<<"case "/utf8, Presence_check/binary>>/binary, " { True -> Some("/utf8>>/binary, (deep_object_constructor_expr(Key, Param, Op_id, Ctx))/binary>>/binary, ") False -> None }"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1543). ?DOC(false). -spec array_item_bool_parse(boolean()) -> binary(). array_item_bool_parse(Trim) -> case Trim of true -> <<"let v = string.trim(item) "/utf8, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>; false -> <<"let v = item "/utf8, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1606). ?DOC(false). -spec single_value_required_expr( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()) ) -> binary(). single_value_required_expr(Bound_var, Schema_ref) -> case Schema_ref of {some, {inline, {array_schema, _, {inline, {string_schema, _, _, _, _, _, _}}, _, _, _}}} -> <<<<"list.map(string.split("/utf8, Bound_var/binary>>/binary, ", \",\"), fn(item) { string.trim(item) })"/utf8>>; {some, {inline, {array_schema, _, {inline, {integer_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <>; {some, {inline, {array_schema, _, {inline, {number_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <>; {some, {inline, {array_schema, _, {inline, {boolean_schema, _}}, _, _, _}}} -> <<<<<<<<"list.map(string.split("/utf8, Bound_var/binary>>/binary, ", \",\"), fn(item) { "/utf8>>/binary, (array_item_bool_parse(true))/binary>>/binary, " })"/utf8>>; {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> <>; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> <>; {some, {inline, {boolean_schema, _}}} -> <<<<<<<<"{ let v = "/utf8, Bound_var/binary>>/binary, " "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " }"/utf8>>; _ -> Bound_var end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1556). ?DOC(false). -spec header_required_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()) ) -> binary(). header_required_expr(Bound_var, Param) -> single_value_required_expr( Bound_var, oaspec@internal@openapi@spec:parameter_schema(Param) ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1577). ?DOC(false). -spec cookie_required_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()) ) -> binary(). cookie_required_expr(Bound_var, Param) -> single_value_required_expr( Bound_var, oaspec@internal@openapi@spec:parameter_schema(Param) ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1635). ?DOC(false). -spec single_value_optional_expr( binary(), binary(), binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()) ) -> binary(). single_value_optional_expr(Lookup, Var, Miss, Schema_ref) -> case Schema_ref of {some, {inline, {array_schema, _, {inline, {string_schema, _, _, _, _, _, _}}, _, _, _}}} -> <<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> Some(list.map(string.split("/utf8>>/binary, Var/binary>>/binary, ", \",\"), fn(item) { string.trim(item) })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; {some, {inline, {array_schema, _, {inline, {integer_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <<<<<<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> Some(list.map(string.split("/utf8>>/binary, Var/binary>>/binary, ", \",\"), fn(item) { "/utf8>>/binary, (array_item_int_parse(true))/binary>>/binary, " })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; {some, {inline, {array_schema, _, {inline, {number_schema, _, _, _, _, _, _, _}}, _, _, _}}} -> <<<<<<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> Some(list.map(string.split("/utf8>>/binary, Var/binary>>/binary, ", \",\"), fn(item) { "/utf8>>/binary, (array_item_float_parse(true))/binary>>/binary, " })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; {some, {inline, {array_schema, _, {inline, {boolean_schema, _}}, _, _, _}}} -> <<<<<<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> Some(list.map(string.split("/utf8>>/binary, Var/binary>>/binary, ", \",\"), fn(item) { "/utf8>>/binary, (array_item_bool_parse(true))/binary>>/binary, " })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; {some, {inline, {integer_schema, _, _, _, _, _, _, _}}} -> <<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> { case int.parse("/utf8>>/binary, Var/binary>>/binary, ") { Ok(n) -> Some(n) _ -> None } } "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; {some, {inline, {number_schema, _, _, _, _, _, _, _}}} -> <<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> { case float.parse("/utf8>>/binary, Var/binary>>/binary, ") { Ok(n) -> Some(n) _ -> None } } "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; {some, {inline, {boolean_schema, _}}} -> <<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> Some("/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, ") "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; _ -> <<<<<<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok("/utf8>>/binary, Var/binary>>/binary, ") -> Some("/utf8>>/binary, Var/binary>>/binary, ") "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1564). ?DOC(false). -spec header_optional_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()) ) -> binary(). header_optional_expr(Key, Param) -> Lookup = <<<<"dict.get(headers, \""/utf8, Key/binary>>/binary, "\")"/utf8>>, single_value_optional_expr( Lookup, <<"v"/utf8>>, <<"_"/utf8>>, oaspec@internal@openapi@spec:parameter_schema(Param) ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1585). ?DOC(false). -spec cookie_optional_expr( binary(), oaspec@internal@openapi@spec:parameter(oaspec@internal@openapi@spec:resolved()) ) -> binary(). cookie_optional_expr(Key, Param) -> Lookup = <<<<"cookie_lookup(headers, \""/utf8, Key/binary>>/binary, "\")"/utf8>>, single_value_optional_expr( Lookup, <<"v"/utf8>>, <<"Error(_)"/utf8>>, oaspec@internal@openapi@spec:parameter_schema(Param) ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 969). ?DOC(false). -spec form_urlencoded_object_required_expr( binary(), oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context(), integer() ) -> binary(). form_urlencoded_object_required_expr(Prefix, Schema_ref, Ctx, Nesting_depth) -> form_urlencoded_object_constructor_expr( form_urlencoded_schema_ref_type_name(Schema_ref), Prefix, object_properties_from_schema_ref(Schema_ref, Ctx), schema_ref_additional_properties(Schema_ref, Ctx), Ctx, Nesting_depth ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 922). ?DOC(false). -spec form_urlencoded_object_constructor_expr( binary(), binary(), list(deep_object_property()), oaspec@internal@openapi@schema:additional_properties(), oaspec@internal@codegen@context:context(), integer() ) -> binary(). form_urlencoded_object_constructor_expr( Type_name, Prefix, Properties, Additional_properties, Ctx, Nesting_depth ) -> Fields = begin _pipe = Properties, _pipe@1 = gleam@list:map( _pipe, fun(Prop) -> Key = form_urlencoded_key(Prefix, erlang:element(2, Prop)), Value_expr = case {(Nesting_depth < 5) andalso schema_ref_resolves_to_object( erlang:element(4, Prop), Ctx ), erlang:element(5, Prop)} of {true, true} -> form_urlencoded_object_required_expr( Key, erlang:element(4, Prop), Ctx, Nesting_depth + 1 ); {true, false} -> form_urlencoded_object_optional_expr( Key, erlang:element(4, Prop), Ctx, Nesting_depth + 1 ); {false, true} -> form_body_required_expr_with_schema( Key, {some, erlang:element(4, Prop)}, Ctx ); {false, false} -> form_body_optional_expr_with_schema( Key, {some, erlang:element(4, Prop)}, Ctx ) end, <<<<(erlang:element(3, Prop))/binary, ": "/utf8>>/binary, Value_expr/binary>> end ), gleam@string:join(_pipe@1, <<", "/utf8>>) end, Additional_props_suffix = case Additional_properties of forbidden -> <<""/utf8>>; unspecified -> <<""/utf8>>; {typed, _} -> <<", additional_properties: dict.new()"/utf8>>; untyped -> <<", additional_properties: dict.new()"/utf8>> end, <<<<<<<>/binary, Fields/binary>>/binary, Additional_props_suffix/binary>>/binary, ")"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 985). ?DOC(false). -spec form_urlencoded_object_optional_expr( binary(), oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context(), integer() ) -> binary(). form_urlencoded_object_optional_expr(Prefix, Schema_ref, Ctx, Nesting_depth) -> Props = object_properties_from_schema_ref(Schema_ref, Ctx), Prop_names = begin _pipe = Props, _pipe@1 = gleam@list:map( _pipe, fun(Prop) -> <<<<"\""/utf8, (erlang:element(2, Prop))/binary>>/binary, "\""/utf8>> end ), gleam@string:join(_pipe@1, <<", "/utf8>>) end, <<<<<<<<<<<<"case form_object_present(form_body, \""/utf8, Prefix/binary>>/binary, "\", ["/utf8>>/binary, Prop_names/binary>>/binary, "]) { True -> Some("/utf8>>/binary, (form_urlencoded_object_constructor_expr( form_urlencoded_schema_ref_type_name(Schema_ref), Prefix, Props, schema_ref_additional_properties(Schema_ref, Ctx), Ctx, Nesting_depth ))/binary>>/binary, ") False -> None }"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1012). ?DOC(false). -spec form_urlencoded_body_constructor_expr( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> binary(). form_urlencoded_body_constructor_expr(Rb, Op_id, Ctx) -> form_urlencoded_object_constructor_expr( form_urlencoded_body_type_name(Rb, Op_id), <<""/utf8>>, form_urlencoded_body_properties(Rb, Ctx), body_additional_properties( Rb, <<"application/x-www-form-urlencoded"/utf8>>, Ctx ), Ctx, 0 ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 77). ?DOC(false). -spec body_field_kind_from_object( oaspec@internal@openapi@schema:schema_object(), oaspec@internal@codegen@context:context() ) -> body_field_kind(). body_field_kind_from_object(Schema_obj, Ctx) -> case Schema_obj of {string_schema, _, _, _, _, _, _} -> body_field_string; {integer_schema, _, _, _, _, _, _, _} -> body_field_int; {number_schema, _, _, _, _, _, _, _} -> body_field_float; {boolean_schema, _} -> body_field_bool; {array_schema, _, Items, _, _, _} -> case body_field_kind(Items, Ctx) of body_field_string -> body_field_string_array; body_field_int -> body_field_int_array; body_field_float -> body_field_float_array; body_field_bool -> body_field_bool_array; _ -> body_field_unknown end; _ -> body_field_unknown end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 53). ?DOC(false). -spec body_field_kind( oaspec@internal@openapi@schema:schema_ref(), oaspec@internal@codegen@context:context() ) -> body_field_kind(). body_field_kind(Schema_ref, Ctx) -> case Schema_ref of {inline, {string_schema, _, _, _, _, _, _}} -> body_field_string; {inline, {integer_schema, _, _, _, _, _, _, _}} -> body_field_int; {inline, {number_schema, _, _, _, _, _, _, _}} -> body_field_float; {inline, {boolean_schema, _}} -> body_field_bool; {inline, {array_schema, _, Items, _, _, _}} -> case body_field_kind(Items, Ctx) of body_field_string -> body_field_string_array; body_field_int -> body_field_int_array; body_field_float -> body_field_float_array; body_field_bool -> body_field_bool_array; _ -> body_field_unknown end; {reference, _, _} = Schema_ref@1 -> case oaspec@internal@codegen@context:resolve_schema_ref( Schema_ref@1, Ctx ) of {ok, Schema_obj} -> body_field_kind_from_object(Schema_obj, Ctx); {error, _} -> body_field_unknown end; _ -> body_field_unknown end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 43). ?DOC(false). -spec schema_ref_body_field_kind( gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> body_field_kind(). schema_ref_body_field_kind(Schema_ref, Ctx) -> case Schema_ref of {some, Schema_ref@1} -> body_field_kind(Schema_ref@1, Ctx); none -> body_field_unknown end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1127). ?DOC(false). -spec multipart_body_needs_int( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). multipart_body_needs_int(Rb, Ctx) -> gleam@list:any( multipart_body_properties(Rb, Ctx), fun(Prop) -> body_field_kind_needs_int( schema_ref_body_field_kind({some, erlang:element(4, Prop)}, Ctx) ) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1139). ?DOC(false). -spec multipart_body_needs_float( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). multipart_body_needs_float(Rb, Ctx) -> gleam@list:any( multipart_body_properties(Rb, Ctx), fun(Prop) -> body_field_kind_needs_float( schema_ref_body_field_kind({some, erlang:element(4, Prop)}, Ctx) ) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1183). ?DOC(false). -spec form_urlencoded_properties_need_int( list(deep_object_property()), oaspec@internal@codegen@context:context(), boolean() ) -> boolean(). form_urlencoded_properties_need_int(Props, Ctx, Allow_nested_objects) -> form_urlencoded_properties_need( Props, Ctx, Allow_nested_objects, fun(Prop) -> body_field_kind_needs_int( schema_ref_body_field_kind({some, erlang:element(4, Prop)}, Ctx) ) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1049). ?DOC(false). -spec form_urlencoded_body_needs_int( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). form_urlencoded_body_needs_int(Rb, Ctx) -> form_urlencoded_properties_need_int( form_urlencoded_body_properties(Rb, Ctx), Ctx, true ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1196). ?DOC(false). -spec form_urlencoded_properties_need_float( list(deep_object_property()), oaspec@internal@codegen@context:context(), boolean() ) -> boolean(). form_urlencoded_properties_need_float(Props, Ctx, Allow_nested_objects) -> form_urlencoded_properties_need( Props, Ctx, Allow_nested_objects, fun(Prop) -> body_field_kind_needs_float( schema_ref_body_field_kind({some, erlang:element(4, Prop)}, Ctx) ) end ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1060). ?DOC(false). -spec form_urlencoded_body_needs_float( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), oaspec@internal@codegen@context:context() ) -> boolean(). form_urlencoded_body_needs_float(Rb, Ctx) -> form_urlencoded_properties_need_float( form_urlencoded_body_properties(Rb, Ctx), Ctx, true ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1379). ?DOC(false). -spec body_required_expr_kind( binary(), binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), boolean(), oaspec@internal@codegen@context:context() ) -> binary(). body_required_expr_kind(Lookup, Base, Schema_ref, Trim_items, Ctx) -> case schema_ref_body_field_kind(Schema_ref, Ctx) of body_field_string_array -> case Trim_items of true -> <<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> list.map(vs, fn(item) { string.trim(item) }) _ -> [] }"/utf8>>; false -> <<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> vs _ -> [] }"/utf8>> end; body_field_int_array -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> list.map(vs, fn(item) { "/utf8>>/binary, (array_item_int_parse(Trim_items))/binary>>/binary, " }) _ -> [] }"/utf8>>; body_field_float_array -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> list.map(vs, fn(item) { "/utf8>>/binary, (array_item_float_parse(Trim_items))/binary>>/binary, " }) _ -> [] }"/utf8>>; body_field_bool_array -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> list.map(vs, fn(item) { "/utf8>>/binary, (array_item_bool_parse(Trim_items))/binary>>/binary, " }) _ -> [] }"/utf8>>; body_field_int -> <<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> case int.parse(v) { Ok(n) -> n _ -> 0 } _ -> 0 }"/utf8>>; body_field_float -> <<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> case float.parse(v) { Ok(n) -> n _ -> 0.0 } _ -> 0.0 }"/utf8>>; body_field_bool -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> "/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, " _ -> False }"/utf8>>; _ -> Base end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1354). ?DOC(false). -spec body_required_expr( binary(), binary(), boolean(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> binary(). body_required_expr(Key, Source, Trim_items, Schema_ref, Ctx) -> Lookup = <<<<<<<<"dict.get("/utf8, Source/binary>>/binary, ", \""/utf8>>/binary, Key/binary>>/binary, "\")"/utf8>>, Base = <<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> v _ -> \"\" }"/utf8>>, case begin _pipe = Schema_ref, gleam@option:then( _pipe, fun(Ref) -> schema_ref_string_enum(Ref, Ctx) end ) end of {some, {Type_name, Values}} -> body_required_enum_expr(Lookup, Type_name, Values); none -> body_required_expr_kind(Lookup, Base, Schema_ref, Trim_items, Ctx) end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1259). ?DOC(false). -spec form_body_required_expr_with_schema( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> binary(). form_body_required_expr_with_schema(Key, Schema_ref, Ctx) -> body_required_expr(Key, <<"form_body"/utf8>>, true, Schema_ref, Ctx). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1275). ?DOC(false). -spec multipart_body_required_expr_with_schema( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> binary(). multipart_body_required_expr_with_schema(Key, Schema_ref, Ctx) -> body_required_expr(Key, <<"multipart_body"/utf8>>, false, Schema_ref, Ctx). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1458). ?DOC(false). -spec body_optional_expr_kind( binary(), binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), boolean(), oaspec@internal@codegen@context:context() ) -> binary(). body_optional_expr_kind(Lookup, Miss, Schema_ref, Trim_items, Ctx) -> case schema_ref_body_field_kind(Schema_ref, Ctx) of body_field_string_array -> case Trim_items of true -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> Some(list.map(vs, fn(item) { string.trim(item) })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; false -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> Some(vs) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>> end; body_field_int_array -> <<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> Some(list.map(vs, fn(item) { "/utf8>>/binary, (array_item_int_parse(Trim_items))/binary>>/binary, " })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; body_field_float_array -> <<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> Some(list.map(vs, fn(item) { "/utf8>>/binary, (array_item_float_parse(Trim_items))/binary>>/binary, " })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; body_field_bool_array -> <<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok(vs) -> Some(list.map(vs, fn(item) { "/utf8>>/binary, (array_item_bool_parse(Trim_items))/binary>>/binary, " })) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; body_field_int -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> { case int.parse(v) { Ok(n) -> Some(n) _ -> None } } "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; body_field_float -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> { case float.parse(v) { Ok(n) -> Some(n) _ -> None } } "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; body_field_bool -> <<<<<<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> Some("/utf8>>/binary, "case string.lowercase(v) { \"true\" -> True _ -> False }"/utf8>>/binary, ") "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>>; _ -> <<<<<<<<"case "/utf8, Lookup/binary>>/binary, " { Ok([v, ..]) -> Some(v) "/utf8>>/binary, Miss/binary>>/binary, " -> None }"/utf8>> end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1433). ?DOC(false). -spec body_optional_expr( binary(), binary(), boolean(), binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> binary(). body_optional_expr(Key, Source, Trim_items, Miss, Schema_ref, Ctx) -> Lookup = <<<<<<<<"dict.get("/utf8, Source/binary>>/binary, ", \""/utf8>>/binary, Key/binary>>/binary, "\")"/utf8>>, case begin _pipe = Schema_ref, gleam@option:then( _pipe, fun(Ref) -> schema_ref_string_enum(Ref, Ctx) end ) end of {some, {Type_name, Values}} -> body_optional_enum_expr(Lookup, Miss, Type_name, Values); none -> body_optional_expr_kind(Lookup, Miss, Schema_ref, Trim_items, Ctx) end. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1267). ?DOC(false). -spec form_body_optional_expr_with_schema( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> binary(). form_body_optional_expr_with_schema(Key, Schema_ref, Ctx) -> body_optional_expr( Key, <<"form_body"/utf8>>, true, <<"_"/utf8>>, Schema_ref, Ctx ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1283). ?DOC(false). -spec multipart_body_optional_expr_with_schema( binary(), gleam@option:option(oaspec@internal@openapi@schema:schema_ref()), oaspec@internal@codegen@context:context() ) -> binary(). multipart_body_optional_expr_with_schema(Key, Schema_ref, Ctx) -> body_optional_expr( Key, <<"multipart_body"/utf8>>, false, <<"_"/utf8>>, Schema_ref, Ctx ). -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1080). ?DOC(false). -spec multipart_body_constructor_expr( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> binary(). multipart_body_constructor_expr(Rb, Op_id, Ctx) -> Fields = begin _pipe = multipart_body_properties(Rb, Ctx), _pipe@1 = gleam@list:map( _pipe, fun(Prop) -> Value_expr = case erlang:element(5, Prop) of true -> multipart_body_required_expr_with_schema( erlang:element(2, Prop), {some, erlang:element(4, Prop)}, Ctx ); false -> multipart_body_optional_expr_with_schema( erlang:element(2, Prop), {some, erlang:element(4, Prop)}, Ctx ) end, <<<<(erlang:element(3, Prop))/binary, ": "/utf8>>/binary, Value_expr/binary>> end ), gleam@string:join(_pipe@1, <<", "/utf8>>) end, Additional_props_suffix = case body_additional_properties( Rb, <<"multipart/form-data"/utf8>>, Ctx ) of forbidden -> <<""/utf8>>; unspecified -> <<""/utf8>>; {typed, _} -> <<", additional_properties: dict.new()"/utf8>>; untyped -> <<", additional_properties: dict.new()"/utf8>> end, <<<<<<<<(multipart_body_type_name(Rb, Op_id))/binary, "("/utf8>>/binary, Fields/binary>>/binary, Additional_props_suffix/binary>>/binary, ")"/utf8>>. -file("src/oaspec/internal/codegen/server_request_decode.gleam", 1732). ?DOC(false). -spec generate_body_decode_expr( oaspec@internal@openapi@spec:request_body(oaspec@internal@openapi@spec:resolved()), binary(), oaspec@internal@codegen@context:context() ) -> binary(). generate_body_decode_expr(Rb, Op_id, Ctx) -> Content_entries = maps:to_list(erlang:element(3, Rb)), case Content_entries of [{Ct_name, Media_type}] -> case oaspec@internal@util@content_type:from_string(Ct_name) of application_json -> Decode_fn = case erlang:element(2, Media_type) of {some, {reference, _, Name}} -> <<<<"decode.decode_"/utf8, (oaspec@internal@util@naming:to_snake_case( Name ))/binary>>/binary, "(body)"/utf8>>; _ -> <<<<"decode.decode_"/utf8, (oaspec@internal@util@naming:to_snake_case( Op_id ))/binary>>/binary, "_request_body(body)"/utf8>> end, case erlang:element(4, Rb) of true -> <<<<"{ let assert Ok(decoded) = "/utf8, Decode_fn/binary>>/binary, " decoded }"/utf8>>; false -> <<<<"case body { \"\" -> None _ -> { case "/utf8, Decode_fn/binary>>/binary, " { Ok(decoded) -> Some(decoded) _ -> None } } }"/utf8>> end; form_url_encoded -> Body_expr = form_urlencoded_body_constructor_expr( Rb, Op_id, Ctx ), case erlang:element(4, Rb) of true -> Body_expr; false -> <<<<"case body { \"\" -> None _ -> Some("/utf8, Body_expr/binary>>/binary, ") }"/utf8>> end; multipart_form_data -> Body_expr@1 = multipart_body_constructor_expr( Rb, Op_id, Ctx ), case erlang:element(4, Rb) of true -> Body_expr@1; false -> <<<<"case body { \"\" -> None _ -> Some("/utf8, Body_expr@1/binary>>/binary, ") }"/utf8>> end; _ -> case erlang:element(4, Rb) of true -> <<"body"/utf8>>; false -> <<"case body { \"\" -> None _ -> Some(body) }"/utf8>> end end; _ -> case erlang:element(4, Rb) of true -> <<"body"/utf8>>; false -> <<"case body { \"\" -> None _ -> Some(body) }"/utf8>> end end.