-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
refactor(golang): Use http provided constants for http methods #3028
Conversation
CI reports the following errors:
Looks like the |
Oh, the edge case comes into play when the Also This is my first real interaction with mustache and this edge case seems more complex to handle than I initially thought. Maybe the simplest solution is to always import it and hush the compiler with
Thoughts? Also what does this do exactly? Maybe I'm misunderstanding something where this could be used
|
The |
Yup, that's another edge case that I've not yet encountered with other generators. As a workaround, what about using "strings" somehow in the code so as to hardcode the import? |
Ah, the import logic is handled here Lines 364 to 371 in 2614670
strings to that was enough. No workarounds needed
|
Thanks again for the PR, which has been included in the v4.0.2 release: https://twitter.com/oas_generator/status/1141610197766426626 |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master
,4.1.x
,5.0.x
. Default:master
.@antihax @bvwells @grokify @kemokemo
Description of the PR
This modifies the golang client to use the http constants for method types as defined by RFC 7231 section 4.3. These are documented on:
https://golang.org/pkg/net/http/#pkg-constants
This does not require any new dependencies, as net/http is already imported.
Based on: #2983