私はJSON Schema Validatorの完全な初心者ですが、私は非常に強力だと思います。しかし、私は1つのJSONを検証できません。NodeJS JSONスキーマ検証が機能しない
これは
{
title: "Example Schema",
type: "object",
properties: {
original_image:{
type: "object",
properties: {
temp_id: {type: "string"},
url: {type: "string"},
scale:{
type: "object",
properties:{
new_width: {type: "number"},
new_height: {type: "number"}
},
required:["new_width","new_height"]
}
},
required:["url","temp_id","scale"]
}
},
required:["image"]
}
私のスキーマであり、これは実際のJSONです:あなたは「original_image」から「URL」プロパティを見ることができるように
{
"original_image": {
"temp_id": "this is my id",
"scale": {
"new_width": null,
"new_height": 329
}
}
}
ありませんが、検証真を返します!そして、 "new_width"の場合、値をnullに設定し、再度検証を渡すので、何が間違っているのか分かりません。
私はダッシュでjson-schemaを使用していましたが、jsonschemaはうまく機能していません。だから私は "jsonschema"パッケージに切り替えるでしょう、それはうまくいった! –