Merge pull request #7400 from DDDHuang/fix_examples_spec

fix: api examples spec error
This commit is contained in:
zhongwencool 2022-03-25 11:03:27 +08:00 committed by GitHub
commit f1b511023d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -109,7 +109,10 @@ 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) ->
hoconsc:mk(Type, #{examples => #{<<"examples">> => Examples}}). %% Swagger can dynamically distinguish if there are multiple 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) ->