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

Fixed the generation of model properties whose data type is a composed (allOf) schema #704

Conversation

rubms
Copy link
Contributor

@rubms rubms commented Aug 1, 2018

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 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\.
  • Filed the PR against the correct branch: master, 4.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

Fixed issue #582. The problem came from the a897fee commit in the #360 pull request. After that commit, the generation of model properties whose data type is a composed (allOf) schema was broken: the data type name of the generated property was that of the first model participating in the allOf clause.

After this fix the property data type is again as expected: the one of the composed schema and not one of its parents (models involved in an allOf clause).

cc @jmini @wing328

…type is a composed (allOf) schema. Before this fix, the data type name of the generated property was that of the first model participating in the allOf clause. After this fix the property data type is again as expected: the one of the composed schema and not one of its parents.
@rubms
Copy link
Contributor Author

rubms commented Aug 1, 2018

This affects the generation of models in every language. Should I run the generation of all the samples as well? I have done it locally and I observe that some samples were outdated and contain changes unrelated to this fix.

@wing328
Copy link
Member

wing328 commented Aug 1, 2018

@rubms thanks for the PR. Let me take a look first.

cc the core team as well: @jimschubert @ackintosh @cbornet @JFCote @jaz-ah

…OpenAPITools#582 issue (references to composed schemas should not get unaliased for them to get a proper data type name in the generation of model properties).
@jmini
Copy link
Member

jmini commented Aug 1, 2018

@rubms you should run at least ./bin/utils/ensure-up-to-date because it updates the samples/ that are checked by Shippable CI.

Read more: https://github.com/OpenAPITools/openapi-generator/wiki/Pull-Request-Checklist#shippable-ensure-up-to-date

@jmini
Copy link
Member

jmini commented Aug 1, 2018

PS: As for the case of

Shippable — Run 1917 status is FAILED.

This is not related to this change, also the builds on master branch are broken with the same error.

@rubms
Copy link
Contributor Author

rubms commented Aug 1, 2018

Thanks @jmini. I'm on it.

@jmini
Copy link
Member

jmini commented Aug 1, 2018

@rubms: you can just merge master into your branch.

@wing328 wing328 modified the milestones: 3.2.0, 3.2.1 Aug 6, 2018
@JFCote
Copy link
Member

JFCote commented Aug 8, 2018

@jmini
Can this be Squash and merged? :)

Copy link
Member

@JFCote JFCote left a comment

Choose a reason for hiding this comment

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

LGTM

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.

The fix looks good to me.

@JFCote JFCote merged commit d0ccac5 into OpenAPITools:master Aug 8, 2018
@JFCote
Copy link
Member

JFCote commented Aug 8, 2018

Merged!

@rubms
Copy link
Contributor Author

rubms commented Aug 9, 2018

Thanks everyone!

@rubms rubms deleted the #582_Fixed_generation_of_properties_of_composed_schemas branch August 9, 2018 09:47
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request Aug 14, 2018
* master: (32 commits)
  Fixed date formatting in typescript node client (OpenAPITools#786)
  better explain usage (OpenAPITools#794)
  Fix float/double default value in C# generator (OpenAPITools#791)
  Enhancements to documentation generators (samples, default values, etc) (OpenAPITools#790)
  Remove duplicate variable declaration (OpenAPITools#792)
  Issue 758 root resource (OpenAPITools#771)
  Do not declare destructor as default when destructor is explicitly declared. (OpenAPITools#732)
  Fix C# client enum issue (OpenAPITools#774)
  [JavaScript] Update vulnerable dependencies (OpenAPITools#784)
  [Ruby] Fix method split (OpenAPITools#780)
  [Java][jaxrs-jersey] add sample with jaxrs-jersey + openapi v3 (OpenAPITools#778)
  update groupId in pom (OpenAPITools#779)
  [cpp-restsdk] Support multi-line descriptions (OpenAPITools#753)
  [Core] Resolve Inline Models (OpenAPITools#736)
  [gradle] Support nullable system property values (OpenAPITools#764)
  Correct URL for openapi-generator.cli.sh in README.md (OpenAPITools#770)
  Fixed the generation of model properties whose data type is a composed (allOf) schema (OpenAPITools#704)
  [JAX-RS][Spec] Add samples to CircleCI (OpenAPITools#759)
  minor update to python generator usage (OpenAPITools#762)
  [C++][Restbed/Pistache] Added fix for byte array (OpenAPITools#752)
  ...
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…d (allOf) schema (OpenAPITools#704)

* OpenAPITools#582 Fixed the generation of model properties whose data type is a composed (allOf) schema. Before this fix, the data type name of the generated property was that of the first model participating in the allOf clause. After this fix the property data type is again as expected: the one of the composed schema and not one of its parents.

* Added unit test in order to have regression testing in the fix for the OpenAPITools#582 issue (references to composed schemas should not get unaliased for them to get a proper data type name in the generation of model properties).

* Run ./bin/utils/ensure-up-to-date to re-generate samples run in the CI.

* Removed tabs from ModelUtilsTest.java
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

4 participants