chore: support list(tuple()) for schema_with_examples/3

This commit is contained in:
zhongwencool 2023-11-05 12:30:49 +08:00
parent f04cafe57e
commit b343653769
3 changed files with 4 additions and 2 deletions

View File

@ -185,7 +185,8 @@ fields(meta) ->
schema_with_example(Type, Example) -> schema_with_example(Type, Example) ->
hoconsc:mk(Type, #{examples => #{<<"example">> => Example}}). hoconsc:mk(Type, #{examples => #{<<"example">> => Example}}).
-spec schema_with_examples(hocon_schema:type(), map()) -> hocon_schema:field_schema_map(). -spec schema_with_examples(hocon_schema:type(), map() | list(tuple())) ->
hocon_schema:field_schema_map().
schema_with_examples(Type, Examples) -> schema_with_examples(Type, Examples) ->
hoconsc:mk(Type, #{examples => #{<<"examples">> => Examples}}). hoconsc:mk(Type, #{examples => #{<<"examples">> => Examples}}).

View File

@ -48,7 +48,7 @@ remove_handler() ->
post_config_update(?PROMETHEUS, _Req, New, Old, AppEnvs) -> post_config_update(?PROMETHEUS, _Req, New, Old, AppEnvs) ->
update_prometheus(AppEnvs), update_prometheus(AppEnvs),
update_push_gateway(New), _ = update_push_gateway(New),
update_auth(New, Old); update_auth(New, Old);
post_config_update(_ConfPath, _Req, _NewConf, _OldConf, _AppEnvs) -> post_config_update(_ConfPath, _Req, _NewConf, _OldConf, _AppEnvs) ->
ok. ok.

View File

@ -44,6 +44,7 @@ start_link() ->
start_child(Mod, Conf) when is_atom(Mod) -> start_child(Mod, Conf) when is_atom(Mod) ->
assert_started(supervisor:start_child(?MODULE, ?CHILD(Mod, Conf))). assert_started(supervisor:start_child(?MODULE, ?CHILD(Mod, Conf))).
-spec update_child(pid() | atom(), map()) -> ok.
update_child(Pid, Conf) -> update_child(Pid, Conf) ->
erlang:send(Pid, {update, Conf}), erlang:send(Pid, {update, Conf}),
ok. ok.