[英]How to define json schma for multiple type array
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 架構
TestResults:
type: array
items:
anyOf:
- type: string
- $ref: "#/components/schemas/TestResults"
我不確定給定的架構是否正確。 籠統地說,TestResults 由任何字符串及其本身組成。
你可以按照這個例子來了解這個
"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.