Skip to content

docs: Document strict validation for newer drafts - #19

Merged
DannyvdSluijs merged 2 commits into
mainfrom
docs/strict-validation-newer-schemas
Aug 18, 2026
Merged

docs: Document strict validation for newer drafts#19
DannyvdSluijs merged 2 commits into
mainfrom
docs/strict-validation-newer-schemas

Conversation

@DannyvdSluijs

@DannyvdSluijsDannyvdSluijs commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Closes#18

Strict mode was documented as "Draft 6 only", which has been out of date since 6.10.0 added the Draft 2019-09 constraint set.

New page: Strict mode

A dedicated _docs/strict-mode.md (nav priority 18, between Check mode and Advanced topics) covering:

  • What CHECK_MODE_STRICT actually does — it selects the constraint set of one specific draft (the dialect) based on the schema's $schema keyword, rather than being a "stricter" flavour of normal validation.
  • Which drafts support it — Draft 6, Draft 7 and Draft 2019-09.
  • The fallback for schemas without $schema — Draft 6 by default, changeable via Factory::setDefaultDialect() using the JsonSchema\DraftIdentifiers constants.

Other changes

  • advanced-topics.md — removed the stale "Validating using strict mode (Draft 6 only)" section in favour of a pointer to the new page. It also used an # H1 mid-page, which kept it out of the sidebar table of contents (config/docs.php sets min_heading_level to 2).
  • check-mode.md — the CHECK_MODE_STRICT row read "Validate the schema using strict mode", which describes what CHECK_MODE_VALIDATE_SCHEMA does. Reworded, and linked to the new page.
  • Fixed example code that could not run: $jsonSchema->$id (a variable-variable, not the $id property), $jsonSchemaObject undefined in three snippets, and Constraint used without an import.

Verification

Every claim was executed against jsonrainbow/json-schema at 6.10.0 rather than read off the source:

  • Draft 2019-09 strict reports the dependentRequired violation; without strict mode the same document passes
  • Draft 6 and Draft 7 strict accept valid and reject invalid documents
  • Factory::getDefaultDialect() is Draft 6; setDefaultDialect(DRAFT_2019_09) changes the outcome for a schema with no $schema; a $schema keyword wins over the default dialect

The site builds cleanly, the sidebar orders Getting started → Check mode → Strict mode → Advanced topics, and all table-of-contents anchors and cross-page links resolve.

_site/ build output is intentionally not included, since the Pages workflow rebuilds from source on push to main.

🤖 Generated with Claude Code

Strict mode was documented as "Draft 6 only", which has been out of date
since 6.10.0 added the Draft 2019-09 constraint set. Add a dedicated
Strict mode page covering:
- what CHECK_MODE_STRICT actually does (selects a draft-specific
constraint set from the $schema keyword)
- which drafts support it: Draft 6, Draft 7 and Draft 2019-09
- the Draft 6 fallback for schemas without $schema, and changing it
with Factory::setDefaultDialect() and the DraftIdentifiers constants
- the InvalidArgumentException thrown for unsupported drafts such as
Draft 2020-12
- the keyword differences between the dialects, including that
`dependencies` is silently ignored under Draft 2019-09
Also repairs the surrounding examples, which did not run: `$jsonSchema->$id`
was a variable-variable rather than the $id property, `$jsonSchemaObject`
was undefined in three snippets, and the strict mode snippet used
Constraint without importing it. The stray H1 mid-page kept the section
out of the sidebar table of contents.
Closes#18
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@DannyvdSluijsDannyvdSluijs self-assigned this Aug 18, 2026
@DannyvdSluijsDannyvdSluijs added the documentation Improvements or additions to documentation label Aug 18, 2026
Drop the "Unsupported drafts throw" and "Differences between the
dialects" sections. Both leaned on internals rather than on how to use
the library, which is more detail than this page needs. The supported
drafts table already tells readers which dialects strict mode covers.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@DannyvdSluijs
DannyvdSluijs merged commit fb44f38 into mainAug 18, 2026
@DannyvdSluijs
DannyvdSluijs deleted the docs/strict-validation-newer-schemas branch August 18, 2026 21:22
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the strict validation for newer schemas.

1 participant

@DannyvdSluijs