json架构 - 基于输入属性指定字符串长度

问题描述 投票:0回答:1
JSON模式有可能指定一个字符串长度,该长度取决于正在验证的项目中的属性值?

,例如,我有一个带有值3的“ foo”属性的文档。我想确保“ bar”属性是至少3

的字符串 samplejson

{ "foo": 3, "bar": "111" }

json模式

{ "properties" : { "foo": { "type": "integer", "minimum": 1 } "bar": { "type": "string", "minLength": "{$foo}" } } }

有一个v5
关键字
的proposal,它将“ wallow schemas使用来自数据的值,使用JSON Pointers或相对JSON POINTERS指定的值”。
jsonschema
1个回答
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.