Skip to content

Improve format - #285

Merged
jdesrosiers merged 2 commits into
mainfrom
improve-format
Oct 5, 2026
Merged

jdesrosiers merged 2 commits into
mainfrom
improve-format

Conversation

@jdesrosiers

Copy link
Copy Markdown
Collaborator

Whether format behaves as an assertion depends on how the validator is configured, so success and negated messages always said that format only applies if formats are validated. Now the error handler context says whether a format keyword was validated. The format handler uses plain messages when it was, says nothing when it's only an annotation, and keeps the hedged messages when it's not known.

jsonSchemaErrors takes an isFormatAsserted option because only the caller knows how their validator was configured. The JSE output format works it out from @hyperjump/json-schema's shouldValidateFormat setting and each dialect's default. Formats that aren't supported always pass, so they aren't validated either.

This also adds support for the v1 format keyword.

jdesrosiers and others added 2 commits October 5, 2026 11:54
Error handlers, getErrors, and getSuccesses now take an
ErrorHandlerContext instead of the AST. The context has the AST and
gives a place for information about how the instance was validated,
which needs to reach handlers through nested descriptions, including
ones built by third-party applicator handlers. describeEach and
describeScope take the context too because they describe subschemas.
Helpers that only read the schema still take the AST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whether 'format' is an assertion depends on how the validator is
configured, so success and negated messages always said that 'format'
only applies if formats are validated. Now the error handler context
says whether a 'format' keyword was validated. The format handler uses
plain messages when it was, says nothing when it's only an annotation,
and keeps the hedged messages when it's not known.

jsonSchemaErrors takes an isFormatAsserted option because only the
caller knows how their validator was configured. The JSE output format
works it out from @hyperjump/json-schema's shouldValidateFormat setting
and each dialect's default. Formats that aren't supported always pass,
so they aren't validated either.

This also adds support for the v1 'format' keyword.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jdesrosiers
jdesrosiers merged commit cec54a8 into main Oct 5, 2026
2 checks passed
@jdesrosiers
jdesrosiers deleted the improve-format branch October 5, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant