[OCaml] Fix default optional list#20789
Conversation
* `{{^isContainer}}foobar{{/isContainer}}{{^isContainer}}` is equivalent to `{{^isContainer}}foobar`
* Add indentations to make it easier to read the template. The generated code is
uglier, but it is ok since users are encouraged to reformat anyway
|
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors. Let me know if you need help fixing it. |
|
Ah thanks, we mostly use Gitlab at Routine so I had not added my Routine email to my Github profile. Fixed now 👍 |
|
I quickly reviewed both commits and everything looks good to me. It's a pity that the generated code looks uglier but I admit that writing the template on a single line to keep the output pretty was a real pain. Thanks for your contributions to the OCaml generator ! I am glad someone uses it :) |
|
If it were up to me I would |
|
FYI Jane Street started their own openapi 3 generator. |
* Cleanup the existing model template
* `{{^isContainer}}foobar{{/isContainer}}{{^isContainer}}` is equivalent to `{{^isContainer}}foobar`
* Add indentations to make it easier to read the template. The generated code is
uglier, but it is ok since users are encouraged to reformat anyway
* Add a default value for non-required lists
Closes OpenAPITools#20777
Add a default value for non-required lists.
Also, indent the model template to make it easier to read and maintain.
I have kept 2 commits to easily review the cleanup vs the actual fix, and its impact on the sample petstore.
Closes #20777
@cgensoul
PR checklist
Commit all changed files.
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*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)