-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[erlang-client] Fix url path generation being passed to hackney_url #14821
Conversation
Looks like the change to the path generation was made in cdc0076 which was trying to fix another issue perhaps. cdc0076#diff-8a7b672a5f73867d594118b21ae6930335ddfb72e820a10c1c94a2773a494e76R6-R24 Here's an example where the current sample client fails--we are supposed to be requesting pet id 2> petstore_pet_api:get_pet_by_id(#{}, 10, #{cfg => #{host => "https://petstore.swagger.io"}}).
[hackney trace 80 <0.275.0> 2023:02:26 18:39:25 4415] request
Content: [{module,hackney},
{line,313},
{method,get},
{url,{hackney_url,hackney_ssl,https,<<"petstore.swagger.io">>,
<<"/v2/pet/\n">>,<<"/v2/pet/%0A">>,<<>>,<<>>, % <---- notice how 10 is converted to %0A
"petstore.swagger.io",443,<<>>,<<>>}},
{headers,[]},
{body,[]},
{options,[]}]
[hackney trace 60 <0.275.0> 2023:02:26 18:39:25 4417] request without proxy
Content: [{module,hackney},{line,685}]
[hackney trace 60 <0.275.0> 2023:02:26 18:39:25 4425] connect
Content: [{module,hackney_connect},
{line,32},
{transport,hackney_ssl},
{host,"petstore.swagger.io"},
{port,443},
{dynamic,true}]
[hackney trace 80 <0.275.0> 2023:02:26 18:39:25 4453] no socket in the pool
Content: [{module,hackney_pool},{line,88},{pool,default}]
[hackney trace 80 <0.275.0> 2023:02:26 18:39:25 4816] new connection
Content: [{module,hackney_pool},{line,94}]
[hackney trace 60 <0.275.0> 2023:02:26 18:39:25 4816] reuse a connection
Content: [{module,hackney_connect},{line,216},{pool,default}]
[hackney trace 40 <0.275.0> 2023:02:26 18:39:25 4817] perform request
Content: [{module,hackney_request},
{line,106},
{header_data,[<<"GET /v2/pet/%0A HTTP/1.1\r\n">>,
[[<<"Host">>,": ",<<"petstore.swagger.io">>,"\r\n"],
[<<"User-Agent">>,": ",<<"hackney/1.18.1">>,
"\r\n"],
"\r\n"]]},
{perform_all,true},
{expect,false}]
[hackney trace 80 <0.275.0> 2023:02:26 18:39:25 4930] got response
cc @lixen-wg2 please let me know if you agree? |
@dweinstein thanks for the PR. can you please PM me via Slack when you've time? https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g |
as discussed, let's move ahead with this change. i'll merge and update the samples. |
samples updated via 6d71db3 |
thanks @wing328 sorry that I hadn't had the chance to make the tweaks to the mustache stuff for the integer handling. It's still on my list. |
take your time. in other generators, we use something like not sure if erlang has something similar. |
This change is attempting to fix a regression in URL Paths in the erlang-client. The current pet_store sample erlang-client does not work against the real
petstore.swagger.io
because of a regression in the Path introduced in cdc0076.Currently if one makes a request for pet id
10
the api client will make a request for%0a
instead.PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(6.3.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks)