Reading schemas
In this site’s JSON Schema examples, the styling of a property tells you what it means in the schema’s dialect.
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/person", "$comment": "A person, with their address", "type": "object", "properties": { "name": { "type": "string" }, "nickname": { "type": "string", "maxLenght": 20 }, "address": { "$ref": "#/$defs/address" } }, "$defs": { "address": { "$anchor": "address", "type": "string" } }}In draft-04 through draft-07, a $ref replaces the schema it’s in. The
whole object is the reference and the rest of it has no effect.
{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "name": { "type": "string" } }, "properties": { "name": { "$ref": "#/definitions/name", "minLength": 1 } }}In v1, a property that starts with x- is an annotation, not an unknown
keyword.
{ "$schema": "https://json-schema.org/v1", "type": "string", "x-deprecated": true}| Looks like | Means | In the examples |
|---|---|---|
| Bold name | A keyword | type, properties |
| Bold italic name | A core keyword: one that identifies, references, or holds schemas | $schema, $id, $ref, $defs |
| Bold value | The dialect, from $schema |
https://json-schema.org/draft/2020-12/schema |
| Dotted underline | An identifier | The values of $id and $anchor |
| Underline | A reference | #/$defs/address, and all of the draft-07 object with $ref |
| Gray italic | Has no effect, like a comment | $comment, the misspelled maxLenght, and minLength next to the draft-07 $ref |
| Italic name | An annotation in v1 | x-deprecated |
| Plain name | Not a keyword | name, nickname, address |
On a lint rule’s page, what the rule reports also has a wavy underline. It’s orange for a warning and red for an error. The message follows the example.
Each example’s header says what it is: either JSON Schema and its dialect, or JSON that isn’t a schema.