Repository navigation
Support System.Text.Json serialization of LTree - #4006
Merged
Merged
Conversation
Add a type-level string converter without changing query-only operations. Make the converter public for source-generated JSON contexts. Co-authored-by: Copilot App <[email protected]> Copilot-Session: be699e8c-b6bd-4df1-9e12-8884e2e6f945
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The localized change has focused regression coverage and no identified blocking issues; tests were not executed.
No open issues 🎉
What changed in this PR
Adds built-in System.Text.Json support for LTree, avoiding access to query-only properties during serialization and addressing #3538.
Changes:
- Registers a public nested converter for string-valued JSON serialization.
- Adds coverage for standalone values, DTO properties, empty/default and nullable values, source generation, and query-only behavior.
| File | Description |
|---|---|
| test/EFCore.PG.Tests/Types/LTreeTest.cs | Adds serialization and query-only behavior regression tests. |
| src/EFCore.PG/Types/LTree.cs | Adds and registers the JSON converter. |
Review effort: Balanced
This was referenced Oct 18, 2026
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport #4006 to hotfix/10.0.4. (cherry picked from commit aead2ab) Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4200d70c-76b3-4098-8891-5403ef70962f
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport #4006 (aead2ab) to hotfix/9.0.5 without changes. Fixes #3538 Co-authored-by: Copilot App <[email protected]> Copilot-Session: 10dee5d2-a38d-474a-9454-546470abbd84
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport #4006 to hotfix/8.0.12. (cherry picked from commit aead2ab) Co-authored-by: Copilot App <[email protected]> Copilot-Session: d8d8a304-ae5a-4349-bf84-37751d55433c
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.
System.Text.Json currently attempts to read LTree's server-only NLevel property, causing serialization to throw even when no EF query is involved.
Attach a string-valued JSON converter to LTree so standalone values and DTO properties serialize and deserialize without application-level registration. Query-only members continue to throw outside queries. The converter is public and nested to support source-generated JSON contexts.
Includes coverage for standalone values, DTO properties, empty/default values, nullable values, and source-generated serialization.
Fixes #3538