Skip to content

Add extension to store oneOf/anyOf/allOf objects as full properties#9977

Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom
zippolyte:hippo/oneOfproperties
Aug 22, 2021
Merged

Add extension to store oneOf/anyOf/allOf objects as full properties#9977
wing328 merged 2 commits intoOpenAPITools:masterfrom
zippolyte:hippo/oneOfproperties

Conversation

@zippolyte
Copy link
Copy Markdown
Contributor

@zippolyte zippolyte commented Jul 19, 2021

oneOf, anyOf and allOf in a composed schema only store the names of the different objects, so it's not possible to do complex things in the templates depending on things like type of object (things like isArray, isEnum, isPrimitive, ...).

This PR converts the objects to properties and stores them in the vendor extensions x-(oneOf|anyOf|allOf)-as-properties to be used in templates.

cc @wing328 @jimschubert, would appreciate some feedback on this, thanks 🙂

I plan on using them in custom templates for now, so I have no template change in this PR, but I feel this could be useful to have here.

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.
  • File the PR against the correct branch: master, 5.3.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jul 21, 2021

@zippolyte thanks for the enhancement. I'll review later this week and let you know if I've any questions.

@zippolyte
Copy link
Copy Markdown
Contributor Author

@wing328 I just merged master hoping it fixes the circle ci build 🙂

@wing328 wing328 added this to the 5.3.0 milestone Aug 22, 2021
@wing328 wing328 merged commit 5b072ea into OpenAPITools:master Aug 22, 2021
@wing328
Copy link
Copy Markdown
Member

wing328 commented Aug 22, 2021

cc @OpenAPITools/generator-core-team as the change covers default codegen as well.

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