Skip to content

Don't generate extra models for allOf, oneOf, or anyOf of one model #350

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

Conversation

forest-benchling
Copy link
Collaborator

@forest-benchling forest-benchling commented Mar 17, 2021

Currently, we have tons of places where we do something like

	AaSequence:
      properties:
        customFields:
          allOf:
            - $ref: "#/components/schemas/CustomFields"
          description: Custom fields set on the AA sequence.

which causes an unnecessary model AaSequenceCustomFields to be generated, rather than directly referencing the existing CustomFields model.

The OpenAPI 3.1 spec is going to add support for direct sibling properties:

	AaSequence:
      properties:
        customFields:
          $ref: "#/components/schemas/CustomFields"
          description: Custom fields set on the AA sequence.

But since that may be a long ways away, we directly implement a workaround in this PR.

This workaround also applies for oneOf and anyOf.

@forest-benchling forest-benchling marked this pull request as ready for review March 17, 2021 16:12
@forest-benchling
Copy link
Collaborator Author

cc @dbanty @emann @bowenwr @packyg @dtkav

@dbanty dbanty closed this Mar 23, 2021
@dbanty dbanty deleted the branch openapi-generators:benchling-allof-support March 23, 2021 22:49
@forest-benchling
Copy link
Collaborator Author

Oops @dbanty I think this got accidentally closed when you merged the allof branch. I'll resubmit an identical PR off main.

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

Successfully merging this pull request may close these issues.

2 participants