-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Issue 1766 Modified mustache files for Go to support nullable in the … #1869
Conversation
…spec v3.0+; Updated model files running .sh scripts for Go.
@@ -19,6 +19,6 @@ const ( | |||
type {{classname}} struct { | |||
{{#vars}}{{#description}} | |||
// {{{description}}}{{/description}} | |||
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` |
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.
This is the change that I'd like to discuss. In a previous version relative model objects were generated as classes. As we have nullable
support now, I don't think we need to keep this implicit behavior. I'd rather expect to have the pointer defined as it should be - using the nullable
property.
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.
Thank you for your PR! 😃
I agree with you.
@@ -19,6 +19,6 @@ const ( | |||
type {{classname}} struct { | |||
{{#vars}}{{#description}} | |||
// {{{description}}}{{/description}} | |||
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` |
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.
This is the change that I'd like to discuss. In a previous version relative model objects were generated as classes. As we have nullable
support now, I don't think we need to keep this implicit behavior. I'd rather expect to have the pointer defined as it should be - using the nullable
property.
I have made a brief review. |
@alex-korobko Thanks for the PR! 👍 TO: @OpenAPITools/generator-core-team
I think we need to add |
Not sure if it could help, the |
Sorry I didn't explain it enough. 💦 |
Got it, thanks! So who should create that Shell script to test v3 spec features for Go? Did you recommend me to make the script in this PR or guys from the team are adding such scripts using some other internal workflow? |
Sorry for the late review. |
Hi! I had added the nullable property to the
Can you confirm the content? Also, if it seems good, please apply it to this repository. |
@kemokemo Thanks for your good job! I'm working on that applying your changes to this PR. 😉 |
The updates from @kemokemo has been pushed to this PR. Please take a look if the sample (which is generated from a spec that contains |
Thanks a lot for your help! Let me check the updates. |
FYI: The updates before has generated only "go client", |
@ackintosh Thank you so much for your merging! 😄 issueThe plan to resolve above {{>partial_header}}
package {{packageName}}
{{#models}}{{#imports}}
-import ({{/imports}}{{#imports}}
- "{{import}}"{{/imports}}{{#imports}}
-)
+{{#-first}}import ({{/-first}}
+ "{{import}}"
+{{#-last}}){{/-last}}
{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}}
type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} I am sorry many times. |
I'm working on the issue. 😉 |
I've updated the templates, please have a look when you have time. ✨ |
@ackintosh , thanks a lot for your support! 😉 Everyone, please point out if you notice any problems. |
samples/openapi3/client/petstore/go/go-petstore/model_health_check_result.go
Show resolved
Hide resolved
The PR has been merged into master. Thanks for your contribution! @alex-korobko @kemokemo 👍 👍 👍 |
OpenAPITools#1869) * Issue 1766 Modified mustache files for Go to support nullable in the spec v3.0+; Updated model files running .sh scripts for Go. * Add "nullable" to fake yaml * Add sample script for OAS3 * Fix output folder (openapi3) * Run bin/openapi3/go-petstore.sh * Update samples * Update jaxrs-jersey * Update python and php samples * Add bin/openapi3/go-gin-petstore-server.sh * Run bin/openapi3/go-gin-petstore-server.sh * Update bin/openapi3/go-petstore-server.sh to generate "nullable" samples * Run bin/openapi3/go-petstore-server.sh * Fix duplicated `import`
…spec v3.0+; Updated model files running .sh scripts for Go.
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{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\
.master
,. Default:3.4.x
,4.0.x
master
.Description of the PR
Updated mustache files to enable the
nullable
support (#1766)Ran all ./bin/go*.sh files to update the models;
Not sure though how to test the changes though/ The integration test (as it recommended in the guide) classes for the Golang are using specs from the ver 2.0, so it seems like there is no reason to use them. Should we try to make new classes for that? Do you have any guide for that?
@antihax @bvwells @grokify @kemokemo