【发布时间】:2020-08-04 17:55:02
【问题描述】:
在我的模式定义中,我有一个类型,它具有一个整数属性,它应该是一组“固定”数字中的任何一个。问题是这个“固定集”可能会经常更改。
"person": {
"type": "object",
"properties": {
"aproperty": {
"type": "integer",
"enum": [1, 12, 30 ... , 1000]
},
}
},
有没有办法从远程服务(将有最新的集合)引用这个数组?
"person": {
"type": "object",
"properties": {
"aproperty": {
"type": "integer",
"$ref": "http://localhost:8080/fixed_set"
},
}
},
我尝试了 $ref,但没有运气。 如果“ref”是解决方案的一部分,那么后端应该返回什么?
{
"enum": [1, 12, 30 ... , 1000]
}
或
"enum": [1, 12, 30 ... , 1000]
或
[1, 12, 30 ... , 1000]
【问题讨论】:
标签: json jsonschema json-schema-validator