Documentation
¶
Overview ¶
Package jsonschema declares the error codes and the sentinels of the JSON Schema 2020-12 validator, internal/service/data/codec/jsonschema — range 0.3.103.* (ADR 0210).
The codes live in the core at the path that mirrors the package emitting them (ADR 0160 §2). Nothing here compiles or validates.
Package jsonschema — the sentinel *errs.Error values, one per code. No Public and no Private carries a byte of a schema or a document; the fields name a keyword, a reference or a format, which the schema's author wrote.
Index ¶
Constants ¶
const CodeJSONSchemaFormatUnknown errs.Code = 0x00_03_67_04 // 0.3.103.4
CodeJSONSchemaFormatUnknown identifies a format Config.AssertFormats names that this package cannot check.
const CodeJSONSchemaKeywordRefused errs.Code = 0x00_03_67_02 // 0.3.103.2
CodeJSONSchemaKeywordRefused identifies a keyword refused by name — the dynamic scope ($dynamicRef, $dynamicAnchor), $vocabulary, the unevaluated and content vocabularies — or a "$schema" naming another draft than 2020-12.
const CodeJSONSchemaRefUnresolved errs.Code = 0x00_03_67_03 // 0.3.103.3
CodeJSONSchemaRefUnresolved identifies a "$ref" naming neither a location of the schema nor a resource Config registers: a remote reference is never fetched.
const CodeJSONSchemaReferenceLoop errs.Code = 0x00_03_67_06 // 0.3.103.6
CodeJSONSchemaReferenceLoop identifies a "$ref" cycle an evaluation entered without consuming any of the document.
const CodeJSONSchemaSchemaInvalid errs.Code = 0x00_03_67_01 // 0.3.103.1
CodeJSONSchemaSchemaInvalid identifies a schema NewValidator cannot compile: not exactly one JSON value, a schema that is neither an object nor a boolean, a keyword whose value has the wrong shape, a pattern Go's regexp does not read.
const CodeJSONSchemaViolation errs.Code = 0x00_03_67_05 // 0.3.103.5
CodeJSONSchemaViolation is the code a violation carries when no code of the validation package names its keyword: type, multipleOf, the combinators, the array and object applicators, a false schema, an asserted format.
Variables ¶
var ( // SchemaInvalid refuses a schema NewValidator cannot compile; its field names the problem or the keyword. SchemaInvalid = errs.Static(CodeJSONSchemaSchemaInvalid, "SCHEMA_INVALID", "The schema is not a JSON Schema 2020-12 this validator compiles", "service/data/codec/jsonschema: the schema does not compile; the fields name the problem or the keyword", 0, 0) // KeywordRefused refuses a keyword out of this validator's scope, named in its field. KeywordRefused = errs.Static(CodeJSONSchemaKeywordRefused, "KEYWORD_REFUSED", "The schema uses a keyword this validator does not support", "service/data/codec/jsonschema: a keyword out of scope; the field names it", 0, 0) // RefUnresolved refuses a "$ref" naming nothing compiled or registered; its field names the reference. RefUnresolved = errs.Static(CodeJSONSchemaRefUnresolved, "REF_UNRESOLVED", "A schema reference could not be resolved", "service/data/codec/jsonschema: a $ref names nothing compiled or registered; the field names it", 0, 0) // FormatUnknown refuses a format to assert that this package cannot check. FormatUnknown = errs.Static(CodeJSONSchemaFormatUnknown, "FORMAT_UNKNOWN", "A format to assert is not supported", "service/data/codec/jsonschema: Config.AssertFormats names a format without a checker", 0, 0) // Violation is the sentinel of the code a schema violation carries when no validation code names it. Violation = errs.Static(CodeJSONSchemaViolation, "VIOLATION", "The document does not satisfy the schema", "service/data/codec/jsonschema: the document violates the schema", 422, 0) // ReferenceLoop refuses a validation that entered a "$ref" cycle consuming nothing. ReferenceLoop = errs.Static(CodeJSONSchemaReferenceLoop, "REFERENCE_LOOP", "The schema references itself without end", "service/data/codec/jsonschema: a $ref cycle consumed none of the document", 0, 0) )
Functions ¶
This section is empty.
Types ¶
This section is empty.