Openapi-specification: response multi data model

Created on 10 Nov 2017  路  6Comments  路  Source: OAI/OpenAPI-Specification

i want to use to multi data model in response

according to spec
'OpenAPI 3.0 provides several keywords which you can use to combine schemas'
oneOf that is keyword is used to combine schemas
but OpenAPI doesn`t recognized multi data model

my openAPI code --
paths:
/pets:
patch:
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
responses:
'404':
description: not found
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
components:
schemas:
Dog:
type: object
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
Cat:
type: object
properties:
hunts:
type: boolean
age:
type: integer

All 6 comments

Your definition appears to be valid (excepting the missing openapi and info properties, and the lost indentation). When you say

but OpenAPI doesn`t recognized multi data model

are you referring to a particular tool? If so, you should raise the issue on the appropriate repository, this repository is for the OpenAPI specification itself only.

Facing the same issue as well

@vickysg0210 with which tool(s)? I see you have already commented on https://github.com/swagger-api/swagger-ui/issues/3803

im using online swagger-editor

@MikeRalphson, I think this can be closed, sounds like it's on us over at Swagger-UI 馃槃

Thanks @shockey

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andy-maier picture andy-maier  路  4Comments

aedart picture aedart  路  4Comments

nelz9999 picture nelz9999  路  4Comments

mission-liao picture mission-liao  路  3Comments

ricellis picture ricellis  路  3Comments