Skip to content

Closed schema with undefined required property – valid or invalid? #143

Discussion options

You must be logged in to vote

There are many ways in JSON Schema to construct schemas that always "dead-end" as you put it. A JSON Schema is just a collection of assertions. If a validator knows how to evaluate each assertion, the schema is valid. But, if you add two assertions that are mutually exclusive, you'll get a dead-end (Example: { "allOf": [{ "type": "string" }, { "type": "boolean" }] }). That's a whole other class of problem and one all programming languages have. Consider that the following is a valid program that also has a dead-end.

if (x < 5 && x > 7) {
  console.log("I see dead code");
}

Most programming languages have tools that are often called "linters" to statically (with out running the code) analy…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@frankkilcommins
Comment options

Answer selected by frankkilcommins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants