Skip to content

Commit

Permalink
Fix return types for provide_callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Aug 29, 2024
1 parent 21b0130 commit 5c40296
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand All @@ -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]).
Expand All @@ -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, #{}, #{}}.
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand All @@ -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]).
Expand All @@ -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, #{}, #{}}.
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand All @@ -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]).
Expand All @@ -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, #{}, #{}}.

0 comments on commit 5c40296

Please sign in to comment.