【发布时间】:2017-07-03 16:39:37
【问题描述】:
我有点难以准确描述我需要什么,但我花了一些时间浏览 MSON 规范并没有找到任何东西。
这个例子有点做作,但希望意图很明确。
# Animal (object)
This is a base class for all animals. It provides some common structure.
## Properties
... some properties
# Bird (Animal)
## Properties
... some properties
# Fish (Animal)
## Properties
... some properties
# Farm (Object)
## Properties
+ animals (array[Animal], fixed-type)
我想表达的是,Farm 可以包含各种动物,但不能包含基类。有什么方法可以在 MSON/JSON Schema 中表达它以便验证吗?实际上,我想选择或键入鸟和鱼的联合。我不介意明确写出类。
非常感谢。
【问题讨论】:
标签: apiblueprint mson