Add opt-in JSON Patch support - #18
Open
KastanDay wants to merge 6 commits into
Open
Conversation
KastanDay
force-pushed
the
kastan/schema-reasoning-patch
branch
from
September 9, 2026 00:40
2015a87 to
81d74a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds opt-in
$patchsupport using JSON Patch (RFC 6902), so a shared schema can be narrowed or extended—for example, removingmediumfrom a model's reasoning-effort enum.Supports all six operations, JSON Pointer escaping, array edits, nested patches, and composition with
$merge. Source references resolve before patching; operation values remain literal JSON until the resulting schema is prepared. Each$patchmust produce an object schema.Constructor and configuration updates prepare changes before committing them, preserve the root schema object's identity, and check required root writes before mutation. Unchanged schemas retain their existing branches. Literal defaults, enum members, annotations, and property names remain data. Composition validation counts successful branches and reports nested failures consistently.
Documents the API with a tested example and sets the package version to
0.3.0. Tests cover JSON Patch operations directly with inline Vitest cases, alongside schema integration and lifecycle coverage.Validation
npm run test-all: Cabidela suite passed; AJV comparison mode passed with 239 tests and 19 existing skipsnodejs_compat