[英]How to define an array of a type in an external file in Raml?
如果我有一個定義數據類型SimpleDuple
的文件,並且在定義另一個名為DiscreetFilter
數據類型的另一個文件中,我希望將屬性values
設置為SimpleDuple
數組,那么我將如何使用include?
考慮SimpleDuple的文件:
#%RAML 1.0 DataType
type: object
properties:
id: string
name: string
我想要創建屬性的另一個定義是values
屬性中的SimpleDuples數組(但我必須使用內聯定義)。
#%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
如果那兩個類型在同一個文件中我將values
屬性設置為SimpleDuple[]
。 如果它不是數組,我會將include作為values
屬性的values
。
但是如何同時使用include和數組而不是使用復制代碼中使用的內聯定義?
您應該能夠執行以下操作:
chapter.raml
#%RAML 1.0 DataType
type: object
properties:
name: string
storyboard.raml
#%RAML 1.0 DataType
type: object
properties:
name: string
chapters:
type: array
items: !include chapter.raml
希望有幫助嗎?!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.