diff --git a/modules/openapi-generator/src/main/resources/erlang-server/api.mustache b/modules/openapi-generator/src/main/resources/erlang-server/api.mustache index f876b3a5361f..ba8f13854f61 100644 --- a/modules/openapi-generator/src/main/resources/erlang-server/api.mustache +++ b/modules/openapi-generator/src/main/resources/erlang-server/api.mustache @@ -108,7 +108,8 @@ for the `OperationID` operation. OperationID :: operation_id(), Code :: 200..599, Body :: jesse:json_term(), - ValidatorState :: jesse_state:state()) -> ok | no_return(). + ValidatorState :: jesse_state:state()) -> + ok | {ok, term()} | [ok | {ok, term()}] | no_return(). {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#responses}}validate_response('{{operationId}}', {{code}}, Body, ValidatorState) -> validate_response_body('{{dataType}}', '{{baseType}}', Body, ValidatorState); {{/responses}} @@ -393,7 +394,7 @@ to_list(V) when is_atom(V) -> atom_to_list(V); to_list(V) when is_integer(V) -> integer_to_list(V); to_list(V) when is_float(V) -> float_to_list(V). --spec to_float(iodata()) -> number(). +-spec to_float(iodata()) -> float(). to_float(V) -> binary_to_float(iolist_to_binary([V])). @@ -438,7 +439,7 @@ get_openapi_path() -> -include_lib("kernel/include/file.hrl"). --spec priv_dir(Application :: atom()) -> file:filename(). +-spec priv_dir(Application :: atom()) -> file:name_all(). priv_dir(AppName) -> case code:priv_dir(AppName) of Value when is_list(Value) -> diff --git a/modules/openapi-generator/src/main/resources/erlang-server/rebar.config.mustache b/modules/openapi-generator/src/main/resources/erlang-server/rebar.config.mustache index c2ecd8c9b78f..50cd482ca39b 100644 --- a/modules/openapi-generator/src/main/resources/erlang-server/rebar.config.mustache +++ b/modules/openapi-generator/src/main/resources/erlang-server/rebar.config.mustache @@ -6,7 +6,10 @@ {jesse, "1.8.1"} ]}. -{dialyzer, [{plt_extra_apps, [cowboy, cowlib, ranch, jesse]}]}. +{dialyzer, + [{plt_extra_apps, [cowboy, cowlib, ranch, jesse]}, + {warnings, [missing_return, unknown]} +]}. {xref_checks, [undefined_function_calls, deprecated_function_calls, deprecated_functions]}. diff --git a/samples/server/echo_api/erlang-server/rebar.config b/samples/server/echo_api/erlang-server/rebar.config index c2ecd8c9b78f..50cd482ca39b 100644 --- a/samples/server/echo_api/erlang-server/rebar.config +++ b/samples/server/echo_api/erlang-server/rebar.config @@ -6,7 +6,10 @@ {jesse, "1.8.1"} ]}. -{dialyzer, [{plt_extra_apps, [cowboy, cowlib, ranch, jesse]}]}. +{dialyzer, + [{plt_extra_apps, [cowboy, cowlib, ranch, jesse]}, + {warnings, [missing_return, unknown]} +]}. {xref_checks, [undefined_function_calls, deprecated_function_calls, deprecated_functions]}. diff --git a/samples/server/echo_api/erlang-server/src/openapi_api.erl b/samples/server/echo_api/erlang-server/src/openapi_api.erl index fd60a684c82a..b796f2df4a36 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_api.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_api.erl @@ -108,7 +108,8 @@ for the `OperationID` operation. OperationID :: operation_id(), Code :: 200..599, Body :: jesse:json_term(), - ValidatorState :: jesse_state:state()) -> ok | no_return(). + ValidatorState :: jesse_state:state()) -> + ok | {ok, term()} | [ok | {ok, term()}] | no_return(). validate_response('TestAuthHttpBasic', 200, Body, ValidatorState) -> validate_response_body('binary', 'string', Body, ValidatorState); validate_response('TestAuthHttpBearer', 200, Body, ValidatorState) -> @@ -872,7 +873,7 @@ to_list(V) when is_atom(V) -> atom_to_list(V); to_list(V) when is_integer(V) -> integer_to_list(V); to_list(V) when is_float(V) -> float_to_list(V). --spec to_float(iodata()) -> number(). +-spec to_float(iodata()) -> float(). to_float(V) -> binary_to_float(iolist_to_binary([V])). @@ -917,7 +918,7 @@ get_openapi_path() -> -include_lib("kernel/include/file.hrl"). --spec priv_dir(Application :: atom()) -> file:filename(). +-spec priv_dir(Application :: atom()) -> file:name_all(). priv_dir(AppName) -> case code:priv_dir(AppName) of Value when is_list(Value) -> diff --git a/samples/server/petstore/erlang-server/rebar.config b/samples/server/petstore/erlang-server/rebar.config index c2ecd8c9b78f..50cd482ca39b 100644 --- a/samples/server/petstore/erlang-server/rebar.config +++ b/samples/server/petstore/erlang-server/rebar.config @@ -6,7 +6,10 @@ {jesse, "1.8.1"} ]}. -{dialyzer, [{plt_extra_apps, [cowboy, cowlib, ranch, jesse]}]}. +{dialyzer, + [{plt_extra_apps, [cowboy, cowlib, ranch, jesse]}, + {warnings, [missing_return, unknown]} +]}. {xref_checks, [undefined_function_calls, deprecated_function_calls, deprecated_functions]}. diff --git a/samples/server/petstore/erlang-server/src/openapi_api.erl b/samples/server/petstore/erlang-server/src/openapi_api.erl index f74f29beeff6..16ad18e97823 100644 --- a/samples/server/petstore/erlang-server/src/openapi_api.erl +++ b/samples/server/petstore/erlang-server/src/openapi_api.erl @@ -108,7 +108,8 @@ for the `OperationID` operation. OperationID :: operation_id(), Code :: 200..599, Body :: jesse:json_term(), - ValidatorState :: jesse_state:state()) -> ok | no_return(). + ValidatorState :: jesse_state:state()) -> + ok | {ok, term()} | [ok | {ok, term()}] | no_return(). validate_response('AddPet', 200, Body, ValidatorState) -> validate_response_body('Pet', 'Pet', Body, ValidatorState); validate_response('AddPet', 405, Body, ValidatorState) -> @@ -719,7 +720,7 @@ to_list(V) when is_atom(V) -> atom_to_list(V); to_list(V) when is_integer(V) -> integer_to_list(V); to_list(V) when is_float(V) -> float_to_list(V). --spec to_float(iodata()) -> number(). +-spec to_float(iodata()) -> float(). to_float(V) -> binary_to_float(iolist_to_binary([V])). @@ -764,7 +765,7 @@ get_openapi_path() -> -include_lib("kernel/include/file.hrl"). --spec priv_dir(Application :: atom()) -> file:filename(). +-spec priv_dir(Application :: atom()) -> file:name_all(). priv_dir(AppName) -> case code:priv_dir(AppName) of Value when is_list(Value) ->