Skip to content

chore(deps): migrate to JsonSchema.Net 9 - #533

Merged
mrviduus merged 1 commit into
mainfrom
fix/jsonschema-net-9
Sep 2, 2026
Merged

chore(deps): migrate to JsonSchema.Net 9#533
mrviduus merged 1 commit into
mainfrom
fix/jsonschema-net-9

Conversation

@mrviduus

Copy link
Copy Markdown
Owner

Closes the work #526 was asking for. Three API changes, found by building against 9.4.0 and reading
the compiler rather than guessing at release notes:

7.3.49.4.0
Evaluate(JsonNode, …)Evaluate(JsonElement, …)
EvaluationResults.HasErrorsgone — check Errors is { Count: > 0 }
JsonPointer.CountSegmentCount

The JsonElement signature removes a JsonNode.Parse round-trip that only existed to satisfy the
old one — the arguments arrive as a JsonElement already.

A call carrying no arguments at all still has to be validated as JSON null rather than skipped: a
schema with required properties must fail when the model sends nothing. That is now an explicit
JsonElement holding null, parsed once and held, because JsonDocument owns unmanaged memory and
doing it per call would leak a document on every tool invocation.

The one case worth a test

That case had none — and it is the only one of the three that had to be re-expressed rather than
renamed, so it is the only one where the migration could silently change behaviour.

It fails with:

$: Value is "null" but should be "object"

A type mismatch at the root rather than a missing property, which is the more accurate complaint —
nothing was sent, so there is no object to be missing a property from. My first assertion looked for
"text" and was simply wrong about what the library should say.

Asserting that exact string also pins the other two migrations: the $ comes from SegmentCount,
and reaching the message at all goes through the Errors dictionary that replaced HasErrors.

A trap worth recording

dotnet test --no-build after a package version change runs the previous binaries. It reported
886 passing here while the test assembly was still linked against JsonSchema.Net 7 — the DLL in
bin/ was dated March. The real result only appeared after deleting bin/obj.

That is the same shape as three other things today: green from an artifact that was not the artifact
under test.

Verification

Clean build. Release build succeeds, dotnet format --verify-no-changes clean, 1422 unit tests
pass
(1421 existing + the new one).

Rollback

Revert. Directory.Packages.props goes back to JsonSchema.Net 7.3.4 and ToolDispatcher to the
JsonNode path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MkGcwmi1fuGCBLmGwdEZ1F

Three API changes, found by building against 9.4.0 and reading the
compiler rather than guessing:
Evaluate(JsonNode) -> Evaluate(JsonElement)
EvaluationResults.HasErrors -> gone; check Errors is { Count: > 0 }
JsonPointer.Count -> SegmentCount
The JsonElement signature removes a JsonNode.Parse round-trip that only
existed to satisfy the old one. A call carrying no arguments at all
still has to be validated as JSON null rather than skipped — a schema
with required properties must fail when the model sends nothing — so
that case is now an explicit JsonElement holding null, parsed once
because JsonDocument owns unmanaged memory.
That case had no test, which is why it is the one worth adding: it is
the only behaviour of the three that had to be re-expressed rather than
renamed. It fails with `$: Value is "null" but should be "object"` — a
type mismatch at the root, not a missing property, which is the more
accurate complaint since nothing was sent to be missing a property from.
Asserting that string also pins the other two migrations: the "$" comes
from SegmentCount, and reaching the message goes through the Errors
dictionary.
Note for the next person: `dotnet test --no-build` after a package
version change runs the previous binaries. It reported 886 passing here
while the test assembly was still linked against JsonSchema.Net 7, and
the truth only appeared after deleting bin/obj — the stale DLL was from
March.
Verified on a clean build: Release build, dotnet format, 1422 unit tests.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MkGcwmi1fuGCBLmGwdEZ1F
@mrviduus
mrviduus merged commit 92d2453 into mainSep 2, 2026
7 checks passed
@mrviduus
mrviduus deleted the fix/jsonschema-net-9 branch September 2, 2026 04:36
Sign up for freeto 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

@mrviduus