我们希望拥有多种类型的嵌套数组(字符串,整数,浮点数)。
以下是我想要的yaml片段
definitions:
A:
type: object
required:
- data
- fields
properties:
data:
type: array
items:
type: array
items:
# I want to support number & string in this array
type: number | string
fields:
type: array
items:
type: string
因此可以在下面看到数据
{"data": [[1, "a", 3, 9],[2, "b", 5, 8]], fields: ["AV", "AS"]}
答案 0 :(得分:-1)
我提到了这个示例https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
definitions:
Pet:
type: object
discriminator: petType
properties:
name:
type: string
petType:
type: string
required:
- name
- petType
Cat:
description: A representation of a cat
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
huntingSkill:
type: string
description: The measured skill for hunting
default: lazy
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
Dog:
description: A representation of a dog
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
packSize:
type: integer
format: int32
description: the size of the pack the dog is from
default: 0
minimum: 0
required:
- packSize