Skip to content

[BUG][CLI][GENERATOR] NullPointer when not setting outputDir (updated) #3752

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

Merged
merged 10 commits into from
Aug 25, 2019

Conversation

jimschubert
Copy link
Member

@jimschubert jimschubert commented Aug 25, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./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.
  • Filed the PR against the correct branch: master, 4.1.x, 5.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Replaces #3448

  • WorkflowSettings now holds the same default values whether you create defaults via simple constructor (new WorkflowSettings) or via builder (WorkflowSettings.newBuilder()…build()).
  • Updates ruby petstore sample to have strictSpecBehavior=false to match outputs prior to 4.0.0.
  • Ensures that users can't "null out" fields that require values and have project-specified defaults.
  • Includes work by @Fjolnir-Dvorak to fix outputDir and updating of boolean values.
  • Adds a missed WorkflowSettings builder assignment when deserializing configs from json
  • Adds a test case to prevent a regression of [BUG][CLI][GENERATOR] NullPointer when not setting outputDir #3439

@OpenAPITools/generator-core-team

Ruby core team (@cliffano @zlx @autopp) fyi about the strictSpecBehavior=false config for sample output.

Fjolnir-Dvorak and others added 8 commits July 24, 2019 19:48
…re are a few issues here:

- outputDir's default was set to "." but was overwritten by the builder.
- validateSpec was defaulted to true but was overwritten to false by the builder.
- strictSpecBehavior was defaulted to true but was overwritten to false by the builder.

A builder should not have primitive not nullable fields if there are fields containing default which are not nullable.
The main issue I migrated the default value setter to the builder is that fields can be nullable but have set a notnull default. If null is an indicator whether to set the value or not those values could never be set to null.
…ings. Defaults cannot be bypassed and the builder takes the default values from WorkflowSettings as initial values. Every value in WorkflowSettings is defaultable now. Defaults are public so these can be used for consistency and documentation purposes in (e.g.) the flags.
* master: (45 commits)
  update python samples
  Two tiny fixes for Java Vertx client (#3683)
  Exclude "test" from packages so that it is not installed as top-level package when "pip installing" the generated sdk (#3731)
  [java-client] add unit test for JDK 11 HttpClient (#3735)
  [R] feat(r): handling error response for 3xx cases (#3571)
  [Dart] Avoid redundant null checking in fromJson (#3632)
  [core] Set isMultipart=true for multipart operations, fix possible NPE (#3750)
  reenable kotlin client tests in shippable ci (#3751)
  Fix null assignation to header/query param map (#3749)
  Mockito 3.0.0 (#3732)
  Update to swagger-parser to 2.0.14-OpenAPITools.org-1 (#3737)
  Add a link to a Qiita blog post (#3747)
  update csharp samples
  Simple spelling error in dotnet core comments (#3746)
  better support for multipart (#3736)
  [typescript-fetch] fix #1998: prefix req ifaces. (#3740)
  cpp-qt5-client: add valgrind memory test (#3663)
  [typescript-angular] Encode objects for multipart/form-data with json - fixes #2733 (#3738)
  [BUG] Https protocol schema is not handled correctly in java 11 native code #3729 (#3730)
  comment out kotlin client tests
  ...
Copy link
Member

@wing328 wing328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (I've not tested locally)

@jimschubert
Copy link
Member Author

After merging master, it looks like dart samples have changed. I'll regenerate those later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants