PavZav
6 years agoNew Member
Swagger UI - OneOf with discriminator didn't show schema
Hi,
I'm trying this schema structure, but Swagger UI schema example don't show anything.
Simple example:
openapi: 3.0.2 servers: - url: 'http://localhost:8080/' description: Test example info: contact: email: some.email@address.cz title: Test discriminator example version: '0.0.1' license: name: TODO url: 'http://TODO.cz' paths: '/example': get: responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/schema1Resp' components: schemas: schema1Resp: type: object properties: data: oneOf: - $ref: '#/components/schemas/obj1Item' - $ref: '#/components/schemas/obj2Item' discriminator: propertyName: type mapping: obj1: '#/components/schemas/obj1Item' obj2: '#/components/schemas/obj2Item' obj1Item: type: object properties: type: type: string example: obj1 firstTypeStructure: type: integer format: int32 example: 123 obj2Item: type: object properties: type: type: string example: obj1 secondTypeStructure: type: string example: 'Some text'
Swagger UI - example value show nothing, but schema does.
Thans for yours help. :)