Skip to content

Support allOf of compatible types #379

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

Closed
forest-benchling opened this issue Apr 7, 2021 · 1 comment · Fixed by #461
Closed

Support allOf of compatible types #379

forest-benchling opened this issue Apr 7, 2021 · 1 comment · Fixed by #461
Labels
✨ enhancement New feature or improvement
Milestone

Comments

@forest-benchling
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently, allOf requires all schemas in the list to have the same type, and to have the same properties (besides nullable and required). However, we have a number of instances of schema inheritance, where we are using an enum key to distinguish the subclasses. For example:

    Parent:
      additionalProperties: false
      properties:
        type:
          type: string
    Child1:
      additionalProperties: false
	  allOf:
		- $ref: "#/components/schemas/Parent"
        - type: object
          properties:
	        type:
	          type: string
			  enum:
	  		    - child1
    Child1:
      additionalProperties: false
	  allOf:
		- $ref: "#/components/schemas/Parent"
        - type: object
          properties:
	        type:
	          type: string
			  enum:
	  		    - child1

Describe the solution you'd like
We would like allOf to be able to combine two enums, or a string and an enum, and take the more restrictive type.

Describe alternatives you've considered
We could refactor out another schema, which consists of everything in Parent besides the type.

Additional context

@forest-benchling forest-benchling added the ✨ enhancement New feature or improvement label Apr 7, 2021
@forest-benchling
Copy link
Collaborator Author

cc @dtkav @bowenwr @packyg

@dbanty dbanty added this to the 0.10.2 milestone Aug 1, 2021
dbanty added a commit that referenced this issue Aug 1, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…pes [#379, #423, #461]. Thanks @forest-benchling! (#461)

Co-authored-by: Forest Tong <forest@benchling.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment