json-schema-org/understanding-json-schema

`$schema` description is inaccurate

OddBloke opened this issue · 1 comments

schema.rst includes this sentence:

The $schema keyword is used to declare that a JSON fragment is actually a piece of JSON Schema.

This is incorrect; JSON Schema doesn't place any restrictions on JSON documents, so it's perfectly valid for a non-schema JSON document to include a $schema key. (The meaning of that key would be specific to the writers/readers of that particular document.)

Conversely, it's also not the case that a piece of JSON Schema will have a $schema key; its presence in root schemas is only a SHOULD, and it MUST NOT appear in sub-schemas (which are, of course, JSON fragments that are actually pieces of JSON Schema).

(#50 is related to this, but given the age of that issue I was asked to open a new one. I was also asked to note that this should be a post-draft-8 discussion.)

Fixed by #147 and #158