fix: authn bad examples

This commit is contained in:
DDDHuang 2022-04-13 15:51:39 +08:00
parent 9ef1795985
commit bf827cffa8
2 changed files with 26 additions and 24 deletions

View File

@ -1412,17 +1412,9 @@ authenticator_examples() ->
status_metrics_example() -> status_metrics_example() ->
#{ #{
metrics => #{ status_metrics => #{
matched => 0, summary => <<"Authn status metrics">>,
success => 0, value => #{
failed => 0,
rate => 0.0,
rate_last5m => 0.0,
rate_max => 0.0
},
node_metrics => [
#{
node => node(),
metrics => #{ metrics => #{
matched => 0, matched => 0,
success => 0, success => 0,
@ -1430,16 +1422,29 @@ status_metrics_example() ->
rate => 0.0, rate => 0.0,
rate_last5m => 0.0, rate_last5m => 0.0,
rate_max => 0.0 rate_max => 0.0
} },
node_metrics => [
#{
node => node(),
metrics => #{
matched => 0,
success => 0,
failed => 0,
rate => 0.0,
rate_last5m => 0.0,
rate_max => 0.0
}
}
],
status => connected,
node_status => [
#{
node => node(),
status => connected
}
]
} }
], }
status => connected,
node_status => [
#{
node => node(),
status => connected
}
]
}. }.
request_user_create_examples() -> request_user_create_examples() ->

View File

@ -109,10 +109,7 @@ schema_with_example(Type, Example) ->
-spec(schema_with_examples(hocon_schema:type(), map()) -> hocon_schema:field_schema_map()). -spec(schema_with_examples(hocon_schema:type(), map()) -> hocon_schema:field_schema_map()).
schema_with_examples(Type, Examples) -> schema_with_examples(Type, Examples) ->
%% Swagger can dynamically distinguish if there are multiple examples. hoconsc:mk(Type, #{examples => #{<<"examples">> => Examples}}).
%% But explicitly declaring examples as plural
%% may cause some example structures to be incorrectly identified.
schema_with_example(Type, Examples).
-spec(error_codes(list(atom())) -> hocon_schema:fields()). -spec(error_codes(list(atom())) -> hocon_schema:fields()).
error_codes(Codes) -> error_codes(Codes) ->