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 31c58c741cb71..2bdb840de5f9e 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,7 +8,8 @@ fun((atom(), {{packageName}}_api:operation_id(), cowboy_req:req(), context()) -> boolean() | {created, iodata()} | {see_other, iodata()}). -type provide_callback() :: - fun((atom(), {{packageName}}_api:operation_id(), cowboy_req:req(), context()) -> cowboy_req:resp_body()). + fun((atom(), {{packageName}}_api:operation_id(), cowboy_req:req(), context()) -> + {cowboy_req:resp_body(), cowboy_req:req(), context()}. -type context() :: #{binary() => any()}. -export_type([context/0, api_key_callback/0, accept_callback/0, provide_callback/0]). @@ -22,7 +23,7 @@ boolean() | {created, iodata()} | {see_other, iodata()}. -callback provide_callback(atom(), {{packageName}}_api:operation_id(), cowboy_req:req(), context()) -> - cowboy_req:resp_body(). + {cowboy_req:resp_body(), cowboy_req:req(), context()}. -export([api_key_callback/2, accept_callback/4, provide_callback/4]). -ignore_xref([api_key_callback/2, accept_callback/4, provide_callback/4]). @@ -45,11 +46,11 @@ accept_callback(Class, OperationID, Req, Context) -> {501, #{}, #{}}. -spec provide_callback(atom(), {{packageName}}_api:operation_id(), cowboy_req:req(), context()) -> - cowboy_req:resp_body(). + {cowboy_req:resp_body(), cowboy_req:req(), context()}. provide_callback(Class, OperationID, Req, Context) -> ?LOG_ERROR(#{what => "Got not implemented request to process", class => Class, operation_id => OperationID, request => Req, context => Context}), - <<>>. + {501, #{}, #{}}. 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 4ff7ea6e10ed7..a47d30faf3de3 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,7 +8,8 @@ fun((atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> boolean() | {created, iodata()} | {see_other, iodata()}). -type provide_callback() :: - fun((atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> cowboy_req:resp_body()). + fun((atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> + {cowboy_req:resp_body(), cowboy_req:req(), context()}. -type context() :: #{binary() => any()}. -export_type([context/0, api_key_callback/0, accept_callback/0, provide_callback/0]). @@ -22,7 +23,7 @@ boolean() | {created, iodata()} | {see_other, iodata()}. -callback provide_callback(atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> - cowboy_req:resp_body(). + {cowboy_req:resp_body(), cowboy_req:req(), context()}. -export([api_key_callback/2, accept_callback/4, provide_callback/4]). -ignore_xref([api_key_callback/2, accept_callback/4, provide_callback/4]). @@ -45,11 +46,11 @@ accept_callback(Class, OperationID, Req, Context) -> {501, #{}, #{}}. -spec provide_callback(atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> - cowboy_req:resp_body(). + {cowboy_req:resp_body(), cowboy_req:req(), context()}. provide_callback(Class, OperationID, Req, Context) -> ?LOG_ERROR(#{what => "Got not implemented request to process", class => Class, operation_id => OperationID, request => Req, context => Context}), - <<>>. + {501, #{}, #{}}. 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 4ff7ea6e10ed7..a47d30faf3de3 100644 --- a/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl +++ b/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl @@ -8,7 +8,8 @@ fun((atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> boolean() | {created, iodata()} | {see_other, iodata()}). -type provide_callback() :: - fun((atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> cowboy_req:resp_body()). + fun((atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> + {cowboy_req:resp_body(), cowboy_req:req(), context()}. -type context() :: #{binary() => any()}. -export_type([context/0, api_key_callback/0, accept_callback/0, provide_callback/0]). @@ -22,7 +23,7 @@ boolean() | {created, iodata()} | {see_other, iodata()}. -callback provide_callback(atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> - cowboy_req:resp_body(). + {cowboy_req:resp_body(), cowboy_req:req(), context()}. -export([api_key_callback/2, accept_callback/4, provide_callback/4]). -ignore_xref([api_key_callback/2, accept_callback/4, provide_callback/4]). @@ -45,11 +46,11 @@ accept_callback(Class, OperationID, Req, Context) -> {501, #{}, #{}}. -spec provide_callback(atom(), openapi_api:operation_id(), cowboy_req:req(), context()) -> - cowboy_req:resp_body(). + {cowboy_req:resp_body(), cowboy_req:req(), context()}. provide_callback(Class, OperationID, Req, Context) -> ?LOG_ERROR(#{what => "Got not implemented request to process", class => Class, operation_id => OperationID, request => Req, context => Context}), - <<>>. + {501, #{}, #{}}.