gpt4 book ai didi

Json 架构 "not in"枚举类型?

转载 作者:行者123 更新时间:2023-12-04 16:52:01 28 4
gpt4 key购买 nike

我想用 oneOf仅在 xyType 的值上不同的模式属性(property)。我想要其中两个:一个是 xyType设置为 "1"第二个在哪里xyType任何其他值 .这可以使用 json 模式完成吗?

"oneOf": [
{
"properties": {
"xyType": "enum": ["1"],
"whatever" : "string"
},
"type": "object"
},
{
"properties": {
"xyType": "enum": [], /// NOT "1"?
"whatever" : "string"
},
"type": "object"
}
]

最佳答案

有一个 not运算符,以及 enum关键字,你可以一起使用它们,比如

{
"not": {
"enum": ["1"]
}
}

关于Json 架构 "not in"枚举类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31610354/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com