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

Wrong Schema when multiple anyOf/oneOf are inside allOf #5144

Open
alexby opened this issue Jun 17, 2024 · 0 comments
Open

Wrong Schema when multiple anyOf/oneOf are inside allOf #5144

alexby opened this issue Jun 17, 2024 · 0 comments

Comments

@alexby
Copy link

alexby commented Jun 17, 2024

Q&A

  • OS: Ubuntu
  • Browser: chrome
  • Version: online
  • Method of installation: online
  • Swagger-Editor version: online
  • Swagger/OpenAPI version: 3.1.0

Example Swagger/OpenAPI definition:

openapi: 3.1.0
info:
  version: 0.0.42
  title: some title
paths:
  /v1/user:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - anyOf:
                    - type: object
                      properties:
                        firstA:
                          type: string
                    - type: object
                      properties:
                        firstB:
                          type: string
                  - anyOf:
                    - type: object
                      properties:
                        secondA:
                          type: string
                    - type: object
                      properties:
                        secondB:
                          type: string

Describe the bug you're encountering

Having multiple anyOf (or oneOf) inside the allOf will make the both conditions to be joined in a single anyOf (oneOf). In other words the condition (firstA OR firstB) AND (secondA OR secondB) is rendered like firstA OR firstB OR secondA OR secondB.

Expected behavior

image

Actual behavior

image

Additional context or thoughts

Having different conditions (oneOf & anyOf) under the same allOf will be resulted in a correct Schema.

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

No branches or pull requests

1 participant