问题描述
在我的 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
我希望 200 响应中的 petType
属性会发生这样的事情:
http://redocly.github.io/redoc/#operation/findPetsByStatus
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)