Skip to content

Commit 20b5059

Browse files
authored
Erlang server (#20087)
* erlang-server: Extend provided return * Regenerate erlang-server handlers
1 parent 85f7112 commit 20b5059

File tree

13 files changed

+19
-10
lines changed

13 files changed

+19
-10
lines changed

modules/openapi-generator/src/main/resources/erlang-server/handler.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
136136
{Res, Req1, State#state{context = Context1}}.
137137

138138
-spec handle_type_provided(cowboy_req:req(), state()) ->
139-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
139+
{ {{packageName}}_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
140140
handle_type_provided(Req, #state{operation_id = OperationID,
141141
provide_callback = Handler,
142142
context = Context} = State) ->

modules/openapi-generator/src/main/resources/erlang-server/logic_handler.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
| {true, iodata()}
99
| {created, iodata()}
1010
| {see_other, iodata()}.
11+
-type provide_callback_return() ::
12+
stop
13+
| cowboy_req:resp_body().
1114
-type api_key_callback() ::
1215
fun(({{packageName}}_api:operation_id(), binary()) -> {true, context()} | {false, iodata()}).
1316
-type accept_callback() ::

samples/server/echo_api/erlang-server/src/openapi_auth_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
138138
{Res, Req1, State#state{context = Context1}}.
139139

140140
-spec handle_type_provided(cowboy_req:req(), state()) ->
141-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
141+
{ openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
142142
handle_type_provided(Req, #state{operation_id = OperationID,
143143
provide_callback = Handler,
144144
context = Context} = State) ->

samples/server/echo_api/erlang-server/src/openapi_body_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
258258
{Res, Req1, State#state{context = Context1}}.
259259

260260
-spec handle_type_provided(cowboy_req:req(), state()) ->
261-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
261+
{ openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
262262
handle_type_provided(Req, #state{operation_id = OperationID,
263263
provide_callback = Handler,
264264
context = Context} = State) ->

samples/server/echo_api/erlang-server/src/openapi_form_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
141141
{Res, Req1, State#state{context = Context1}}.
142142

143143
-spec handle_type_provided(cowboy_req:req(), state()) ->
144-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
144+
{ openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
145145
handle_type_provided(Req, #state{operation_id = OperationID,
146146
provide_callback = Handler,
147147
context = Context} = State) ->

samples/server/echo_api/erlang-server/src/openapi_header_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
105105
{Res, Req1, State#state{context = Context1}}.
106106

107107
-spec handle_type_provided(cowboy_req:req(), state()) ->
108-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
108+
{ openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
109109
handle_type_provided(Req, #state{operation_id = OperationID,
110110
provide_callback = Handler,
111111
context = Context} = State) ->

samples/server/echo_api/erlang-server/src/openapi_logic_handler.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
| {true, iodata()}
99
| {created, iodata()}
1010
| {see_other, iodata()}.
11+
-type provide_callback_return() ::
12+
stop
13+
| cowboy_req:resp_body().
1114
-type api_key_callback() ::
1215
fun((openapi_api:operation_id(), binary()) -> {true, context()} | {false, iodata()}).
1316
-type accept_callback() ::

samples/server/echo_api/erlang-server/src/openapi_path_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
105105
{Res, Req1, State#state{context = Context1}}.
106106

107107
-spec handle_type_provided(cowboy_req:req(), state()) ->
108-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
108+
{ openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
109109
handle_type_provided(Req, #state{operation_id = OperationID,
110110
provide_callback = Handler,
111111
context = Context} = State) ->

samples/server/echo_api/erlang-server/src/openapi_query_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ handle_type_accepted(Req, #state{operation_id = OperationID,
240240
{Res, Req1, State#state{context = Context1}}.
241241

242242
-spec handle_type_provided(cowboy_req:req(), state()) ->
243-
{cowboy_req:resp_body(), cowboy_req:req(), state()}.
243+
{ openapi_logic_handler:provide_callback_return(), cowboy_req:req(), state()}.
244244
handle_type_provided(Req, #state{operation_id = OperationID,
245245
provide_callback = Handler,
246246
context = Context} = State) ->

samples/server/petstore/erlang-server/src/openapi_logic_handler.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
| {true, iodata()}
99
| {created, iodata()}
1010
| {see_other, iodata()}.
11+
-type provide_callback_return() ::
12+
stop
13+
| cowboy_req:resp_body().
1114
-type api_key_callback() ::
1215
fun((openapi_api:operation_id(), binary()) -> {true, context()} | {false, iodata()}).
1316
-type accept_callback() ::

0 commit comments

Comments
 (0)