[英]How to define json schma for multiple type array
Json Sample: Json 样品:
{
"testResults": [
"begin",
[
"call step 1.1",
"call step 1.2"
],
[
"call step 2.1",
[
"call step 2.1.1",
[
"call step 2.1.1.1",
"call step 2.1.1.2"
],
[
"call step 2.1.2.1",
"call step 2.1.2.2"
],
"end call step 2.1.1"
]
],
"end"
]
}
Json Schema Json 架构
TestResults:
type: array
items:
anyOf:
- type: string
- $ref: "#/components/schemas/TestResults"
I am not sure the given schema is correct.我不确定给定的架构是否正确。 For a general saying, the TestResults is composed of any of string(s) and itself.笼统地说,TestResults 由任何字符串及其本身组成。
You can follow this example to get an idea about this你可以按照这个例子来了解这个
"SampleSchema": {
"type": "object",
"properties": {
"daysOfWeek": {
"description": "An array of zero or more days of the week",
"type": "array",
"items": {
"type": "string",
"enum": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.