-
-
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
[GO] dont canonize headers #10779
[GO] dont canonize headers #10779
Conversation
@andrewkav thanks for the PR. What about fixing this issue without adding an option to start with as your fix looks to be the correct behaviour to me (plus we want to avoid too many options in the generator)? |
@wing328 |
My take is to make this the default behaviour and we'll then find out if there's any valid use cases that must use the current/old behaviour. |
51f45f7
to
3659153
Compare
Alright, I removed additional parameter, defaulting to non canonized headers (will preserve what's in the OpenAPI spec) |
Tested it locally and it broke the following tests:
Can you please take a look when you've time? Looks like 2 tests in auth_test.go need to be updated. |
050027a
to
09e267d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with not canonising headers. There must be a reason why someone would use non-canonic version in their OpenAPI spec and we should respect that. Users can update their specification to keep the "old" behavior. The only issue might be a consistency among other languages, but we can solve that separately.
I reran the tests but it's now down to 1 failed test:
@andrewkav can you please take another look when you've time? Here is the command to run the tests:
|
I'm getting some unrelated errors even when running from master
Am I doing something wrong? |
09e267d
to
735ee4b
Compare
735ee4b
to
e47fa0d
Compare
You will need to run the petstore server locally: https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests#how-to-add-integration-tests-for-new-petstore-samples |
Tested locally and all tests passed. |
Golang be default canonizes header names for example
content-type
will be converted toContent-Type
, this PR allows to opt out this behaviour by setting additional property dontCanonizeHeaders=true.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
(5.3.0),6.0.x