refactor(schema): add args to map alias

This commit is contained in:
Zaiming (Stone) Shi 2023-11-10 21:55:20 +01:00
parent 8be718b22f
commit 06e440260f
3 changed files with 5 additions and 4 deletions

View File

@ -108,7 +108,7 @@ http_common_fields() ->
). ).
headers(type) -> headers(type) ->
typerefl:alias("map", list({binary(), binary()})); typerefl:alias("map", list({binary(), binary()}), #{}, [binary(), binary()]);
headers(desc) -> headers(desc) ->
?DESC(?FUNCTION_NAME); ?DESC(?FUNCTION_NAME);
headers(converter) -> headers(converter) ->
@ -121,7 +121,7 @@ headers(_) ->
undefined. undefined.
headers_no_content_type(type) -> headers_no_content_type(type) ->
typerefl:alias("map", list({binary(), binary()})); typerefl:alias("map", list({binary(), binary()}), #{}, [binary(), binary()]);
headers_no_content_type(desc) -> headers_no_content_type(desc) ->
?DESC(?FUNCTION_NAME); ?DESC(?FUNCTION_NAME);
headers_no_content_type(converter) -> headers_no_content_type(converter) ->

View File

@ -865,7 +865,8 @@ typename_to_spec("bytesize()", _Mod) ->
#{type => string, example => <<"32MB">>}; #{type => string, example => <<"32MB">>};
typename_to_spec("wordsize()", _Mod) -> typename_to_spec("wordsize()", _Mod) ->
#{type => string, example => <<"1024KB">>}; #{type => string, example => <<"1024KB">>};
typename_to_spec("map()", _Mod) -> typename_to_spec("map(" ++ Map, _Mod) ->
[$) | _MapArgs] = lists:reverse(Map),
#{type => object, example => #{}}; #{type => object, example => #{}};
typename_to_spec("service_account_json()", _Mod) -> typename_to_spec("service_account_json()", _Mod) ->
#{type => object, example => #{}}; #{type => object, example => #{}};

View File

@ -57,7 +57,7 @@ fields("prometheus") ->
)}, )},
{headers, {headers,
?HOCON( ?HOCON(
typerefl:alias("map", list({string(), string()})), typerefl:alias("map", list({string(), string()}), #{}, [string(), string()]),
#{ #{
default => #{}, default => #{},
required => false, required => false,