Skip to content
Francis Galiegue edited this page Apr 1, 2014 · 2 revisions

Goal

Define a customizable syntax checking strategy. Detect a number of ill-defined, but legal, schemas.

Features

  • Allow to reject unknown $schemas.
  • Allow to reject various "id" mishandlings.
  • Allow to reject unknown keywords.
  • Allow to do "recursive" checking (ie, download referenced schemas if need be).
  • Allow a "fail fast" mode.

Options

Suggested name: SchemaSyntaxOption, interface; default implementation DefaultSchemaSyntaxOption.

DEREFERENCE_EXTERNAL_SCHEMAS (disabled by default)

By default, only the syntax of embedded JSON References is checked; this option causes the process to load schemas at these references and validate them, recursively so.

This option cannot be enabled at the same time than STOP_AT_FIRST_SYNTAX_ERROR.

STOP_AT_FIRST_SYNTAX_ERROR (disabled by default)

By default, the syntax of the whole schema will be checked; this option causes the process to stop as soon as a syntax error is encountered.

This option cannot be enabled at the same time than DEREFERENCE_EXTERNAL_SCHEMAS.

FAIL_ON_UNKNOWN_DOLLARSCHEMA (enabled by default)

When this option is active, the syntax process will declare failure if it encounters a $schema it has no knowledge of.

If this option is inactive, the default $schema will be used.

FAIL_ON_MISSING_DOLLARSCHEMA (disabled by default)

When this option is active, the syntax process will declare failure if it cannot find a $schema at the top level of a schema.

FAIL_ON_UNKNOWN_KEYWORDS (disabled by default)

When this option is active, syntax validation will raise an error if unknown keywords are encountered in the schema. When inactive, only a warning will be emitted.

Since the specification explicitly allows any object member other than schema keywords in a JSON Schema, this option is disabled by default.

FAIL_ON_DUPLICATE_RESOLUTION_SCOPE (enabled by default)

"id"s can be written so that a resolution scope is duplicated within a schema; when this option is active, syntax validation will fail if it detects a duplicate resolution scope.

FAIL_ON_ILLEGAL_JSON_REFERENCES (enabled by default)

"id"s can be written so that a resolution scope is an invalid JSON Reference; if this option is enabled, such an occurrence will raise a syntax error.

API

TODO