如何在JSON Schema中指定用户验证项目列表(如字符串)的结构?
这是我到目前为止所做的:
"list_of_str": {
"type": "array",
"items": {
"type": "string"
}
}
提前致谢!
答案 0 :(得分:1)
>>> res = {
... "type": "array",
... "items": {
... "type": "string"
... }
... }
>>>
>>> one = ["one", "two"]
>>>
>>>
>>> validictory.validate(one, res)
>>> # No error
“validictory是一个通用的Python数据验证器,允许验证任意Python数据结构。” (见这 - > Validictory docs)