Dav*_*aez 4 arrays types modularity include raml
如果我有一个定义数据类型的文件SimpleDuple,并在另一个定义另一个数据类型的文件中,DiscreetFilter我希望将一个属性values作为一个数组,SimpleDuple我将如何使用include?
考虑SimpleDuple的文件:
#%RAML 1.0 DataType
type: object
properties:
id: string
name: string
Run Code Online (Sandbox Code Playgroud)
我要创建属性的另一个定义是属性中的SimpleDuples数组values(但我必须使用内联定义).
#%RAML 1.0 DataType
type: object
properties:
field: string
name: string
type: { enum: [ discreet ] }
# Ideally this property would use an include
# in some way to express the equivalent of SimpleDuple[]
values:
type: array
properties:
id: string
name: string
Run Code Online (Sandbox Code Playgroud)
如果那两个类型在同一个文件中我将values属性设置为 SimpleDuple[].如果它不是数组,我会将include作为values属性的值.
但是如何同时使用include和数组而不是使用复制代码中使用的内联定义?
chr*_*gel 13
您应该能够执行以下操作:
chapter.raml
#%RAML 1.0 DataType
type: object
properties:
name: string
Run Code Online (Sandbox Code Playgroud)
storyboard.raml
#%RAML 1.0 DataType
type: object
properties:
name: string
chapters:
type: array
items: !include chapter.raml
Run Code Online (Sandbox Code Playgroud)
希望有帮助吗?!