Update JsonPatch.Net and JsonSchema.Net together to latest versions
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 201
Description
## Summary
`JsonPatch.Net` 5.0.0 depends on `JsonPointer.Net` >= 7.0.0, which changed `JsonPointer` from a reference type to a value type. This is incompatible with our currently pinned `JsonSchema.Net` 7.4.0, which was compiled against the older `JsonPointer.Net` where it was a reference type. At runtime this causes:
```
System.TypeLoadException: Could not load type 'Json.Pointer.JsonPointer' from assembly
'JsonSchema.Net, Version=7.0.0.0' due to value type mismatch.
```
### What happened
During the external dependency update in #14549, `JsonPatch.Net` was updated from 3.3.0 to 5.0.0 without also updating `JsonSchema.Net`. This caused `TypeLoadException` failures in all tests that use JSON Schema validation (Hosting, Hosting.Azure, Cli tests).
The fix in #14549 was to revert `JsonPatch.Net` back to 3.3.0.
### What needs to happen
Both packages need to be updated together in a coordinated PR:
1. **`JsonPatch.Net`**: 3.3.0 → 5.0.0 (in `Directory.Packages.props`, external deps section)
2. **`JsonSchema.Net`**: 7.4.0 → 9.1.0 (in `tests/Directory.Packages.props`)
`JsonSchema.Net` 9.x has **breaking API changes** that will require updating the conformance test utilities:
- `JsonSchema.Evaluate()` now takes `JsonElement` instead of `JsonNode`
- `EvaluationResults.HasErrors` was removed or renamed
- The `JsonSchema.FromFile()` / `JsonSchema.FromText()` API may have changed to a two-phase build-then-evaluate pattern
### Files to update
- `Directory.Packages.props` — `JsonPatch.Net` version
- `tests/Directory.Packages.props` — `JsonSchema.Net` version
- `tests/Aspire.Components.Common.TestUtilities/ConformanceTests.cs` — lines ~388-412, update `Evaluate()` call signatures and `HasErrors` usage
- Mirror both new package versions via the `dotnet-migrate-package` pipeline if not already on internal feeds
### References
- PR that discovered this: #14549
- JsonSchema.Net migration guide: https://docs.json-everything.net/schema/basics/
- JsonPatch.Net 5.0.0 depends on JsonPointer.Net >= 7.0.0
Contributor guide
Research direction
Start with Directory.Packages.props, tests/Directory.Packages.props, and tests/Aspire.Components.Common.TestUtilities/ConformanceTests.cs around lines 388-412; review the JsonSchema.Net migration guide and the dotnet-migrate-package pipeline. Update both package versions and adapt the conformance utilities to the new APIs, then run the Hosting, Hosting.Azure, and Cli tests without TypeLoadException failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100