swagger-editor
swagger-editor copied to clipboard
Wrong Schema when multiple anyOf/oneOf are inside allOf
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
Actual behavior
Additional context or thoughts
Having different conditions (oneOf & anyOf) under the same allOf will be resulted in a correct Schema.