Json schema "not in" type enumeration?

I would like to use oneOf schemes that differ only in the value of the xyType property. I would like to have two of them: one where xyType set to "1" , and the second where xyType any other value . Can this be done using json schemas?

 "oneOf": [ { "properties": { "xyType": "enum": ["1"], "whatever" : "string" }, "type": "object" }, { "properties": { "xyType": "enum": [], /// NOT "1"? "whatever" : "string" }, "type": "object" } ] 
+5
source share
1 answer

There is a not operator and the enum keyword here, and you can use them together, for example

 { "not": { "enum": ["1"] } } 
+8
source

All Articles