diff --git a/schemas/id value.yml b/schemas/id value.yml new file mode 100644 index 0000000..1af823e --- /dev/null +++ b/schemas/id value.yml @@ -0,0 +1,76 @@ +description: id value +cases: + - directive: | + The value for this keyword MUST be a string, and MUST be a valid URI. + This URI MUST be normalized + specifications: + - $schema: "http://json-schema.org/draft-04/schema#" + section: | + draft-zyp-json-schema-04 + 7.2. URI resolution scope alteration with the "id" keyword + 7.2.1. Valid values + - $schema: "http://json-schema.org/draft-06/schema#" + section: draft‑wright‑json‑schema‑01 + - $schema: "http://json-schema.org/draft-07/schema#" + section: draft-handrews-json-schema-01 + - $schema: "https://json-schema.org/draft/2020-12/schema" + section: draft-bhutton-json-schema-01 + schemas: + keyword.id.type.null: + id: null + keyword.id.type.boolean.true: + id: true + keyword.id.type.boolean.false: + id: false + keyword.id.type.integer: + id: 0 + keyword.id.type.number: + id: 1.1 + keyword.id.type.array.empty: + id: [] + keyword.id.type.array.nonempty: + id: [{}] + keyword.id.type.object.withid: + id: {id: "http://json-schema.org/draft-04/schema#"} + # not valid URIs + keyword.id.uri.invalid.port: + id: "http://jsvs:notaport/" + keyword.id.uri.invalid.protocol.incomplete: + id: "http:" + keyword.id.uri.invalid.host.character: + id: "http://local\"host/" + keyword.id.uri.invalid.protocol.character: + id: "ht%0atp://localhost/" + keyword.id.uri.invalid.leading_colons: + id: "::http" + keyword.id.uri.invalid.protocol.numbers: + id: "123://jsvs" + keyword.id.uri.invalid.host.ipv6.syntax: + id: "http://[]/" + keyword.id.uri.invalid.host.ipvfuture.syntax: + id: "http://[v0.]/" + # not normalized + keyword.id.uri.not_normalized.relative.path.dotslash: + id: "/draft-04/./schema" + keyword.id.uri.not_normalized.relative.path.dotdotslash: + id: "/draft-04/../draft-04/../draft-04/schema" + keyword.id.uri.not_normalized.relative.path.trailingdot: + id: "/draft-04/schema/." + keyword.id.uri.not_normalized.relative.path.trailingdotdot: + id: "/draft-04/schema/.." + keyword.id.uri.not_normalized.relative.path.escaped_nonspecial_char: + id: "/%64raft-04/schema" + keyword.id.uri.not_normalized.absolute.port.default_port_included: + id: "http://json-schema.org:80/draft-04/schema" + keyword.id.uri.not_normalized.absolute.path.dotslash: + id: "http://json-schema.org/draft-04/./schema" + keyword.id.uri.not_normalized.absolute.path.dotdotslash: + id: "http://json-schema.org/draft-04/../draft-04/../draft-04/schema" + keyword.id.uri.not_normalized.absolute.path.trailingdot: + id: "http://json-schema.org/draft-04/schema/." + keyword.id.uri.not_normalized.absolute.path.trailingdotdot: + id: "http://json-schema.org/draft-04/schema/.." + keyword.id.uri.not_normalized.absolute.host.escaped_nonspecial_char: + id: "http://%6Ason-schema.org/draft-04/schema" + keyword.id.uri.not_normalized.absolute.host.trailingdot: + id: "http://json-schema.org./draft-04/schema" diff --git a/schemas/keyword schema outside root.yml b/schemas/keyword schema outside root.yml new file mode 100644 index 0000000..3fc57d6 --- /dev/null +++ b/schemas/keyword schema outside root.yml @@ -0,0 +1,43 @@ +description: $schema outside the resource root +cases: + - directive: This keyword MUST be located at the root of a JSON Schema. + specifications: + - $schema: "http://json-schema.org/draft-04/schema#" + section: draft-zyp-json-schema-04 6. The "$schema" keyword + schemas: + keyword.$schema.location.draft-04.outside_doc_root: + $schema: "http://json-schema.org/draft-04/schema#" + items: + $schema: "http://json-schema.org/draft-04/schema#" + items: {} + keyword.$schema.location.draft-04.multiple_outside_root: + $schema: "http://json-schema.org/draft-04/schema#" + definitions: + a: + $schema: "http://json-schema.org/draft-04/schema#" + $id: "https://jsvs/8j0" + items: + $schema: "http://json-schema.org/draft-04/schema#" + - directive: | + The "$schema" keyword MUST NOT appear in non-resource root schema objects. + specifications: + - $schema: "https://json-schema.org/draft/2020-12/schema" + section: | + draft-bhutton-json-schema-01 7.1. Lexical Scope and Dynamic Scope + "$schema" ... MUST only appear in a schema resource's root schema. + draft-bhutton-json-schema-01 8.1.1. The "$schema" Keyword + The "$schema" keyword ... MUST NOT appear in non-resource root schema objects. + schemas: + keyword.$schema.location.draft/2020-12.outside_doc_root: + $schema: "https://json-schema.org/draft/2020-12/schema" + items: + $schema: "https://json-schema.org/draft/2020-12/schema" + items: {} + keyword.$schema.location.draft/2020-12.outside_subschema_resource_root: + $schema: "https://json-schema.org/draft/2020-12/schema" + $defs: + a: + $schema: "https://json-schema.org/draft/2020-12/schema" + $id: "https://jsvs/8j1" + items: + $schema: "https://json-schema.org/draft/2020-12/schema" diff --git a/schemas/keyword schema value.yml b/schemas/keyword schema value.yml new file mode 100644 index 0000000..63278d2 --- /dev/null +++ b/schemas/keyword schema value.yml @@ -0,0 +1,68 @@ +description: $schema value +cases: + - directive: | + The value of this keyword MUST be a URI [RFC3986]. + this URI MUST be both absolute and normalized. + specifications: + - $schema: "http://json-schema.org/draft-04/schema#" + section: draft-zyp-json-schema-04 6. The "$schema" keyword + - $schema: "http://json-schema.org/draft-06/schema#" + section: draft‑wright‑json‑schema‑01 7. The "$schema" keyword + - $schema: "http://json-schema.org/draft-07/schema#" + section: draft-handrews-json-schema-01 7. The "$schema" Keyword + - $schema: "https://json-schema.org/draft/2020-12/schema" + section: draft-bhutton-json-schema-01 8.1.1. The "$schema" Keyword + schemas: + keyword.$schema.type.null: + $schema: null + keyword.$schema.type.boolean.true: + $schema: true + keyword.$schema.type.boolean.false: + $schema: false + keyword.$schema.type.integer: + $schema: 0 + keyword.$schema.type.number: + $schema: 1.1 + keyword.$schema.type.array.empty: + $schema: [] + keyword.$schema.type.array.nonempty: + $schema: [{}] + keyword.$schema.type.object.with$schema: + $schema: {$schema: "http://json-schema.org/draft-04/schema#"} + # not valid URIs + keyword.$schema.uri.invalid.port: + $schema: "http://jsvs:notaport/" + keyword.$schema.uri.invalid.protocol.incomplete: + $schema: "http:" + keyword.$schema.uri.invalid.host.character: + $schema: "http://local\"host/" + keyword.$schema.uri.invalid.protocol.character: + $schema: "ht%0atp://localhost/" + keyword.$schema.uri.invalid.leading_colons: + $schema: "::http" + keyword.$schema.uri.invalid.protocol.numbers: + $schema: "123://jsvs" + keyword.$schema.uri.invalid.host.ipv6.syntax: + $schema: "http://[]/" + keyword.$schema.uri.invalid.host.ipvfuture.syntax: + $schema: "http://[v0.]/" + # not absolute + keyword.$schema.uri.relative: + $schema: "/draft-04/schema" + keyword.$schema.uri.relative.dotdot: + $schema: "../.." + # not normalized + keyword.$schema.uri.port.default_port_included: + $schema: "http://json-schema.org:80/draft-04/schema#" + keyword.$schema.uri.path.dotslash: + $schema: "http://json-schema.org/draft-04/./schema#" + keyword.$schema.uri.path.dotdotslash: + $schema: "http://json-schema.org/draft-04/../draft-04/../draft-04/schema#" + keyword.$schema.uri.path.trailingdot: + $schema: "http://json-schema.org/draft-04/schema/.#" + keyword.$schema.uri.path.trailingdotdot: + $schema: "http://json-schema.org/draft-04/schema/..#" + keyword.$schema.uri.host.escaped_nonspecial_char: + $schema: "http://%6Ason-schema.org/draft-04/schema#" + keyword.$schema.uri.host.trailingdot: + $schema: "http://json-schema.org./draft-04/schema#" diff --git a/schemas/schema document and subschemas type.yml b/schemas/schema document and subschemas type.yml new file mode 100644 index 0000000..e4c591e --- /dev/null +++ b/schemas/schema document and subschemas type.yml @@ -0,0 +1,65 @@ +description: The type of the schema itself +cases: + - directive: A JSON Schema is a JSON document, and that document MUST be an object. + specifications: + - $schema: "http://json-schema.org/draft-04/schema#" + section: draft-zyp-json-schema-04 3.2. JSON Schema, keywords + schemas: + schema.type.draft4.root.boolean.true: + true + schema.type.draft4.root.boolean.false: + false + # The section refers to documents, but the MUST applies to subschemas as well. + schema.type.draft4.subschema.boolean.true: + definitions: {'*': true} + schema.type.draft4.subschema.boolean.false: + definitions: {'*': false} + + - directive: A JSON Schema MUST be an object or a boolean. + specifications: + - $schema: "http://json-schema.org/draft-04/schema#" + section: draft-zyp-json-schema-04 3.2. JSON Schema, keywords + # draft-04 schemas also may not be boolean, tested separately above + - $schema: "http://json-schema.org/draft-06/schema#" + section: draft‑wright‑json‑schema‑01 4.4. JSON Schema documents + - $schema: "http://json-schema.org/draft-07/schema#" + section: draft-handrews-json-schema-01 4.3.1. JSON Schema Values and Keywords + - $schema: "https://json-schema.org/draft/2020-12/schema" + section: draft-bhutton-json-schema-01 4.3. JSON Schema Documents + schemas: + schema.type.root.null: + null + schema.type.root.integer: + 0 + schema.type.root.number: + 1.1 + schema.type.root.string.empty: + "" + schema.type.root.string.uri: + "http://example.com/schema" + schema.type.root.array.empty: + [] + schema.type.root.array.nonempty: + [{}] + # The section refers to documents, but the MUST applies to subschemas as well. + schema.type.subschema.null: + allOf: + - null + schema.type.subschema.integer: + allOf: + - 0 + schema.type.subschema.number: + allOf: + - 1.1 + schema.type.subschema.string.empty: + allOf: + - "" + schema.type.subschema.string.uri: + allOf: + - "http://example.com/schema" + schema.type.subschema.array.empty: + allOf: + - [] + schema.type.subschema.array.nonempty: + allOf: + - [{}]