diff --git a/modules/openapi-generator/src/main/resources/erlang-server/handler.mustache b/modules/openapi-generator/src/main/resources/erlang-server/handler.mustache index 07a174d1895..f20db0f4f71 100644 --- a/modules/openapi-generator/src/main/resources/erlang-server/handler.mustache +++ b/modules/openapi-generator/src/main/resources/erlang-server/handler.mustache @@ -136,7 +136,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { {{packageName}}_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/modules/openapi-generator/src/main/resources/erlang-server/logic_handler.mustache b/modules/openapi-generator/src/main/resources/erlang-server/logic_handler.mustache index b79299a9936..74e15a32fe3 100644 --- a/modules/openapi-generator/src/main/resources/erlang-server/logic_handler.mustache +++ b/modules/openapi-generator/src/main/resources/erlang-server/logic_handler.mustache @@ -8,6 +8,9 @@ | {true, iodata()} | {created, iodata()} | {see_other, iodata()}. +-type provide_callback_return() :: + stop + | cowboy_req:resp_body(). -type api_key_callback() :: fun(({{packageName}}_api:operation_id(), binary()) -> {true, context()} | {false, iodata()}). -type accept_callback() :: diff --git a/samples/server/echo_api/erlang-server/src/openapi_auth_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_auth_handler.erl index d79104f1263..0e70c3490c8 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_auth_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_auth_handler.erl @@ -138,7 +138,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/echo_api/erlang-server/src/openapi_body_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_body_handler.erl index eee075fac66..507d97bdf44 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_body_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_body_handler.erl @@ -258,7 +258,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/echo_api/erlang-server/src/openapi_form_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_form_handler.erl index abb0d9a84ae..f3e03126345 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_form_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_form_handler.erl @@ -141,7 +141,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/echo_api/erlang-server/src/openapi_header_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_header_handler.erl index c74e3d8c854..aab73009b0f 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_header_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_header_handler.erl @@ -105,7 +105,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/echo_api/erlang-server/src/openapi_logic_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_logic_handler.erl index bdc2d8ae3ab..f04ed9018cc 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_logic_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_logic_handler.erl @@ -8,6 +8,9 @@ | {true, iodata()} | {created, iodata()} | {see_other, iodata()}. +-type provide_callback_return() :: + stop + | cowboy_req:resp_body(). -type api_key_callback() :: fun((openapi_api:operation_id(), binary()) -> {true, context()} | {false, iodata()}). -type accept_callback() :: diff --git a/samples/server/echo_api/erlang-server/src/openapi_path_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_path_handler.erl index 77a7854486c..823e8dc9226 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_path_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_path_handler.erl @@ -105,7 +105,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/echo_api/erlang-server/src/openapi_query_handler.erl b/samples/server/echo_api/erlang-server/src/openapi_query_handler.erl index c9f4ae55c5e..253740c663d 100644 --- a/samples/server/echo_api/erlang-server/src/openapi_query_handler.erl +++ b/samples/server/echo_api/erlang-server/src/openapi_query_handler.erl @@ -240,7 +240,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl b/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl index bdc2d8ae3ab..f04ed9018cc 100644 --- a/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl +++ b/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl @@ -8,6 +8,9 @@ | {true, iodata()} | {created, iodata()} | {see_other, iodata()}. +-type provide_callback_return() :: + stop + | cowboy_req:resp_body(). -type api_key_callback() :: fun((openapi_api:operation_id(), binary()) -> {true, context()} | {false, iodata()}). -type accept_callback() :: diff --git a/samples/server/petstore/erlang-server/src/openapi_pet_handler.erl b/samples/server/petstore/erlang-server/src/openapi_pet_handler.erl index 3615fa582ff..595319e056e 100644 --- a/samples/server/petstore/erlang-server/src/openapi_pet_handler.erl +++ b/samples/server/petstore/erlang-server/src/openapi_pet_handler.erl @@ -293,7 +293,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/petstore/erlang-server/src/openapi_store_handler.erl b/samples/server/petstore/erlang-server/src/openapi_store_handler.erl index 2fe658862e3..c85b1acde55 100644 --- a/samples/server/petstore/erlang-server/src/openapi_store_handler.erl +++ b/samples/server/petstore/erlang-server/src/openapi_store_handler.erl @@ -161,7 +161,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) -> diff --git a/samples/server/petstore/erlang-server/src/openapi_user_handler.erl b/samples/server/petstore/erlang-server/src/openapi_user_handler.erl index 587855a32f0..5da69dfec2a 100644 --- a/samples/server/petstore/erlang-server/src/openapi_user_handler.erl +++ b/samples/server/petstore/erlang-server/src/openapi_user_handler.erl @@ -262,7 +262,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID, {Res, Req1, State#state{context = Context1}}. -spec handle_type_provided(cowboy_req:req(), state()) -> - {cowboy_req:resp_body(), cowboy_req:req(), state()}. + { openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}. handle_type_provided(Req, #state{operation_id = OperationID, provide_callback = Handler, context = Context} = State) ->