在我的 openapi yaml 文件中,我有一个Layout模式,它有一个属性fields,它是一个Field对象的数组。我的想法是拥有一个具有公共属性的父字段架构,以及一些继承这些并扩展其特定属性的子架构( TextInput、Select、Toggle等)。
所以,这就是我正在尝试的:
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
编译工作正常,但是当我展开fields
属性时,我看到:
Array ()
Schema not provided
我希望petType
200 响应中的属性会发生类似的情况:
http ://redocly.github.io/redoc/#operation/findPetsByStatus