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

[Inline model resolver] various improvements #12293

Merged
merged 14 commits into from May 10, 2022
Merged

Conversation

wing328
Copy link
Member

@wing328 wing328 commented May 3, 2022

  • better handling of request bodies
  • better inline model naming (avoid using inline_object if possible)
  • fix unique naming

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc https://github.com/orgs/OpenAPITools/teams/generator-core-team

@wing328 wing328 added Breaking change (without fallback) Enhancement: General Inline Schema Handling Schema contains a complex schema in items/additionalProperties/allOf/oneOf/anyOf labels May 3, 2022
@wing328 wing328 added this to the 6.0.0 milestone May 3, 2022
@wing328 wing328 marked this pull request as ready for review May 7, 2022 10:01
@wing328 wing328 closed this May 7, 2022
@wing328 wing328 reopened this May 7, 2022
@wing328
Copy link
Member Author

wing328 commented May 7, 2022

@impl I wonder if you can review this change when you've time as you've filed a similar change. Thank you.

@impl
Copy link
Contributor

impl commented May 7, 2022

Hi @wing328,

This does appear to solve the same problem I was looking to address with #12129, with the additional benefit of better naming for inline models as well. Thank you! I'll close that one in favor of this PR. LGTM!

// TODO revise the commented test below as oneOf is no longer defined inline
//but instead defined using $ref with the new inline model resolver in 6.x
//Assert.assertEquals(operation.imports, Sets.newHashSet("Cat", "Dog"));
Assert.assertEquals(operation.imports, Sets.newHashSet("InlineRequest"));
Copy link
Member Author

Choose a reason for hiding this comment

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

@TiFu FYI. We've updated the inlined resolver to create a separate model/schema for all inline schemas(including oneOf/allOf) in the request bodies.

sorin-florea added a commit to sorin-florea/openapi-generator that referenced this pull request May 10, 2022
…-param-explode

* origin/master:
  Add martindelille to code owners (OpenAPITools#12328)
  add tests to set httpUserAgent in r client (OpenAPITools#12321)
  better error messages for oneOf in java okhttp-gson (OpenAPITools#12311)
  [Inline model resolver] various improvements (OpenAPITools#12293)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change (without fallback) Enhancement: General Inline Schema Handling Schema contains a complex schema in items/additionalProperties/allOf/oneOf/anyOf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants