【发布时间】:2017-05-22 06:24:15
【问题描述】:
json 架构是:
"Deck": {
"type": "array",
"items": {
"$ref": "#/definitions/Card"
},
"minItems": 52,
"maxItems": 52,
"uniqueItems": true
},
那么,我该如何禁止:
let d = new Deck();
d.garbageField = 'fdsf';
使用我的架构?
【问题讨论】:
-
为什么不创建
class? -
因为我需要数组?
-
您可以将 AdditionalItems 设置为 false - 但我认为 Card 的 $schema 是什么很重要。
标签: javascript json jsonschema