Skip to content

Commit

Permalink
fix erlang client compilation error (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Apr 26, 2018
1 parent df26bcb commit bcc7b78
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,7 @@ samples/client/petstore/elixir/mix.lock
samples/client/petstore/groovy/build

# erlang
samples/client/petstore/erlang-client/_build/
samples/client/petstore/erlang-client/rebar.lock
samples/server/petstore/erlang-server/_build/
samples/server/petstore/erlang-server/rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ update_params_with_auth(Cfg, Headers, QS) ->
AuthSettings = maps:get(auth, Cfg, #{}),
Auths = #{ {{#authMethods}}'{{name}}' =>
#{type => '{{type}}',
key => <<"{{keyParamName}}">>,
in => {{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInQuery}}query{{/isKeyInQuery}}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}},
key => <<"{{#isApiKey}}{{keyParamName}}{{/isApiKey}}{{^isApiKey}}Authorization{{/isApiKey}}">>,
in => {{^isApiKey}}header{{/isApiKey}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInQuery}}query{{/isKeyInQuery}}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}},

maps:fold(fun(AuthName, #{type := _Type,
in := In,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ place_order(Ctx, PetstoreOrder, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreOrder,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),

petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ create_user(Ctx, PetstoreUser, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUser,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),

petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
Expand All @@ -48,7 +48,7 @@ create_users_with_array_input(Ctx, PetstoreUserArray, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUserArray,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),

petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
Expand All @@ -69,7 +69,7 @@ create_users_with_list_input(Ctx, PetstoreUserArray, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUserArray,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),

petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
Expand Down Expand Up @@ -174,7 +174,7 @@ update_user(Ctx, Username, PetstoreUser, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUser,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),

petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/erlang-client/src/petstore_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ update_params_with_auth(Cfg, Headers, QS) ->
key => <<"api_key">>,
in => header}, 'petstore_auth' =>
#{type => 'oauth2',
key => <<"">>,
in => }},
key => <<"Authorization">>,
in => header}},

maps:fold(fun(AuthName, #{type := _Type,
in := In,
Expand Down

0 comments on commit bcc7b78

Please sign in to comment.