Skip to content
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

fix: prevent ClassCastException when handling options of (issue #4468) #4495

Merged
merged 2 commits into from
Nov 17, 2019
Merged

fix: prevent ClassCastException when handling options of (issue #4468) #4495

merged 2 commits into from
Nov 17, 2019

Conversation

janweinschenker
Copy link
Contributor

Fixes issue #4468 - Prevent ClassCastException when Dealing with config options of type boolean in both openapi-generator-cli and openapi-generator-maven

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language. @wing328 @jimschubert @bbdouglas @karismann

@janweinschenker janweinschenker changed the title issue 4468 fix: prevent ClassCastException when handling options of t… fix: prevent ClassCastException when handling options of t… Nov 15, 2019
@janweinschenker janweinschenker changed the title fix: prevent ClassCastException when handling options of t… fix: prevent ClassCastException when handling options of (issue #4468) Nov 15, 2019
@wing328
Copy link
Member

wing328 commented Nov 17, 2019

@janweinschenker thanks for the fix, which looks good to me.

if (booleanValue instanceof Boolean) {
result = (Boolean) booleanValue;
} else if (booleanValue instanceof String) {
result = Boolean.parseBoolean((String) booleanValue);
}
Copy link
Member

Choose a reason for hiding this comment

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

@janweinschenker I'll add an else clause to throw a runtime exception here.

@wing328 wing328 added this to the 4.2.2 milestone Nov 17, 2019
@wing328 wing328 merged commit 5181ddc into OpenAPITools:master Nov 17, 2019
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request Nov 17, 2019
…ulti-level-model-hierarchy

* origin/master:
  minor fix to CI failure
  feat(dart-dio): correctly handle Map<String, Object>, List<Object> using JsonObject (OpenAPITools#4401)
  [OCAML] Fixes cloud.drone.io ocaml-test (OpenAPITools#4501)
  [elm] Add support for oneOf (OpenAPITools#4434)
  [BUG] [Java] Client resttemplate and webclient. Form Params are badly added when they are lists  (OpenAPITools#4461)
  fix: prevent ClassCastException when handling options of (issue OpenAPITools#4468) (OpenAPITools#4495)
  Fixes Python client Configuration class so each instance uses its own dicts (OpenAPITools#4485)
@wing328
Copy link
Member

wing328 commented Dec 2, 2019

@janweinschenker thanks for the PR, which has been included in the v4.2.2 release: https://twitter.com/oas_generator/status/1201432648544972800

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.

None yet

2 participants