我正在创建一个用于 Postman 的 JSON 架构,其中包含一些架构定义。我根据架构验证的 JSON 需要与架构定义之一匹配。
示例模式
{
"oneOf": [
{
"$ref": "#/definitions/schema1"
},
{
"$ref": "#/definitions/schema2"
},
{
"$ref": "#/definitions/schema3"
}
],
"definitions": {
"schema1": {
"type": "object",
"properties": {
"propertyA": {
"type": "string"
}
},
"required": [
"propertyA"
]
},
"schema2": {
"type": "object",
"properties": {
"propertyB": {
"type": "string"
}
},
"required": [
"propertyB"
]
},
"schema3": {
"type": "object",
"properties": {
"propertyC": {
"type": "string"
}
},
"required": [
"propertyC"
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
示例 …