-
-
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
[go] Improve examples generation #7576
Conversation
for (CodegenProperty codegenProperty : codegenModel.allVars) { | ||
propertyExamples.add(codegenProperty.name + ": " + constructExampleCode(codegenProperty, modelMaps, processedModelMap)); | ||
} |
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.
We should probably include at least required arguments.
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.
Yeah I wasn't too sure what to do here, keeping simplicity of example, where you'd have to add manually the required arguments, or having everything in a single long line like before, and losing that readability when there are several required arguments, particularly for nested schemas.
I'll try to use the constructor with required arguments to see how it looks.
I also wanted to avoid using it to not advertise it as it's less forward compatible (required arguments can change, thus changing the signature)
CircleCI build was a timeout. I've restarted that job. |
Good to merge @jimschubert ? |
Friendly bump on this @jimschubert @wing328 🙇♂️ |
@zippolyte can you please resolve the merge conflicts when you've time? I'll try to review later today or tomorrow. |
* master: (66 commits) [Typescript][Angular] Fix generated README when using apiModulePrefix (#7725) remove outdated scala files (#7723) [FEAT][TYPESCRIPT-ANGULAR] Add configurationPrefix option to allow generating unique configuration token (#7731) [bug] Fix FILES sort and path provider issue (#7729) better csharp tests (#7727) [go] Improve examples generation (#7576) Fixes #7635: typescript-inversify generator wrongly handles array type parameters (#7636) [Java] Fix import mapping for arrays with reference items of type string (#7182) [Java][Native] Support oneOf/anyOf schemas (#7263) [BUG][Ada] Incorrect client Ada code generated (#7719) add cake, sbt integration (#7713) Use 3.0 spec in documentations, update docs (#7710) remove github.com/antihax/optional from go.sum (#7692) Update junit to newer version (4.13.1) (#7690) [Fix/Dart2] Resolve an exception with status 204 and no body. (#7647) [typescript-angular] pass array as a single JSON string to url query when queryParamObjectFormat=json (fix #7620) (#7649) Add back HttpSigningConfiguration.cs remove HTTPSigningConfiguration.cs add AnyType support to Swift generators (#7644) fix warning, remove trailing spaces (#7659) ...
Generation of go examples in API docs gives code that doesn't compile: there are a couple typos, issues with types and pointers.
PR checklist
./bin/generate-samples.sh
to update all Petstore samples related to your fix. 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