-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
openapiQuestions about specification, validity, and edge casesQuestions about specification, validity, and edge cases
Description
ReDoc version: 2.0.0-rc.12
OpenAPI: 3.0.0
If the whole schema is a oneOf-block, the switch buttons are showing the sub-schema name as title.
If the schema is a allOf-block which contains items which are oneOf-blocks, the title is just "object" or "object or object".
Here's the example code in YAML format:
---
openapi: 3.0.0
info:
title: oneOf Test
version: 1.0.0
paths:
"/test":
get:
summary: Test
responses:
'200':
description: Success
content:
application/json:
schema:
"$ref": "#/components/schemas/Data"
components:
schemas:
Woman:
properties:
haircolor:
type: string
Man:
properties:
weight:
type: integer
Young:
properties:
schoolName:
type: string
Old:
properties:
employerName:
type: string
Data:
allOf:
- type: object
properties:
id:
type: integer
name:
type: string
- oneOf:
- "$ref": "#/components/schemas/Woman"
- "$ref": "#/components/schemas/Man"
- oneOf:
- "$ref": "#/components/schemas/Young"
- "$ref": "#/components/schemas/Old"
- properties:
language:
type: string
And here, the same in JSON format:
{
"openapi": "3.0.0",
"info": {
"title": "oneOf Test",
"version": "1.0.0"
},
"paths": {
"/test": {
"get": {
"summary": "Test",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Data" }
}
}
}
}
}
}
},
"components": {
"schemas": {
"Woman": {
"properties": {
"haircolor": {
"type": "string"
}
}
},
"Man": {
"properties": {
"weight": {
"type": "integer"
}
}
},
"Young": {
"properties": {
"schoolName": {
"type": "string"
}
}
},
"Old": {
"properties": {
"employerName": {
"type": "string"
}
}
},
"Data": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
{
"oneOf": [
{ "$ref": "#/components/schemas/Woman" },
{ "$ref": "#/components/schemas/Man" }
]
},
{
"oneOf": [
{ "$ref": "#/components/schemas/Young" },
{ "$ref": "#/components/schemas/Old" }
]
},
{
"properties": {
"language": {
"type": "string"
}
}
}
]
}
}
}
}Metadata
Metadata
Assignees
Labels
openapiQuestions about specification, validity, and edge casesQuestions about specification, validity, and edge cases
