Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apiblueprint 如何为MSON中的数组指定多个可能的类型(类型联合)?_Apiblueprint_Mson - Fatal编程技术网

Apiblueprint 如何为MSON中的数组指定多个可能的类型(类型联合)?

Apiblueprint 如何为MSON中的数组指定多个可能的类型(类型联合)?,apiblueprint,mson,Apiblueprint,Mson,我有点难以准确地描述我需要什么,但我花了一些时间浏览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

我有点难以准确地描述我需要什么,但我花了一些时间浏览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)
我想表达的是,农场可以容纳各种动物,但不能容纳基本类。是否有某种方式可以在MSON/JSON模式中表达这一点,以便进行验证?实际上,我想要一个选择,或者说是一种鸟和鱼的结合。我不介意明确地写出这些类


非常感谢。

既然您可以显式写出类,我认为可以通过写出数组接受的类型(这些类型恰好都是Animal的子类)来完成

+ animals (array[Fish, Bird], fixed-type)