On my openapi yaml file I have a Layout schema, which has an attribute fields, which is an array of Field objects. My idea is to have a parent Field schema with common attributes, and some children schemas (TextInput, Select, Toggle, etc...) which inherit those and extend with their particular attributes.
So, this is what I'm trying:
Layout:
type: object
properties:
fields:
type: array
items:
$ref: '#/Field'
Field:
type: object
properties:
name:
type: string
description: Field name.
label:
type: string
description: Field label.
description:
type: string
description: Short description explaining the purpose of the field.
fieldType:
type: string
description: Field type.
required:
- name
- label
discriminator: fieldType
mapping:
text: '#/TextInput'
select: '#/Select'
TextInput:
allOf:
- $ref: '#/Field'
- type: object
properties:
placeholder:
type: string
description: Field placeholder. **Only for *text* fields.**
Select:
allOf:
- $ref: '#/Field'
- type: object
properties:
options:
type: array
items:
type: string
multiple:
type: boolean
default: false
Compilation works fine, but when I expand the fields
attribute I see:
Array ()
Schema not provided
I would expect something like what happens here with the petType
attribute in the 200 response:
http://redocly.github.io/redoc/#operation/findPetsByStatus