我有一個存盤 json 的列。我試圖確保只有一組物件可以存盤在此列中,如下面的 json 架構中所述。模式正在作業,除了我能夠將屬性保存show為字串時,它應該被強制為布林值。例如,[{"name"=>"primary_phone", "show"=> "some text"}]正確保存但不應該。我如何強制顯示必須是布林值?
{
"type": "array",
"items": {
"definitions": {
"name": { "type": "string" },
"show": {"type": "boolean"}
},
"required": ["name", "show"]
}
}
uj5u.com熱心網友回復:
您在“專案”下的架構無效。也許你的意思是“屬性”而不是“定義”?
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/314951.html
標籤:红宝石轨道 json jsonschema json-schema-validator
