-
-
Notifications
You must be signed in to change notification settings - Fork 239
Support normalization of objects for Z.DynamicLinq.Json #958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for normalization of JSON objects in arrays to ensure all objects have a consistent schema. This allows querying JSON arrays where not all objects contain the same properties.
Key Changes:
- Introduced normalization utilities for both System.Text.Json and Newtonsoft.Json implementations
- Added
Normalizeproperty to configuration classes with default value oftrue - Added
NormalizationNonExistingPropertyBehaviorenum to control how missing properties are handled
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 25 comments.
Show a summary per file
| File | Description |
|---|---|
SystemTextJsonTests.cs |
Added tests for array normalization functionality and behavior when normalization is disabled |
NewtonsoftJsonTests.cs |
Added similar normalization tests and removed commented-out code |
NormalizeUtils.cs (SystemTextJson) |
Implements JSON array normalization logic with schema building and object normalization |
NormalizeUtils.cs (NewtonsoftJson) |
Parallel implementation for Newtonsoft.Json library |
SystemTextJsonParsingConfig.cs |
Added Normalize property and normalization behavior configuration |
NewtonsoftJsonParsingConfig.cs |
Added corresponding normalization configuration properties |
NormalizationNonExistingPropertyBehavior.cs |
New enum defining how to handle missing properties during normalization (both libraries) |
JsonValueInfo.cs |
Internal struct for tracking JSON value type and schema information (both libraries) |
JsonValueExtensions.cs |
Extension method for getting JsonValueKind on pre-.NET 8 platforms |
SystemTextJsonExtensions.cs |
Integrated normalization into the query pipeline |
NewtonsoftJsonExtensions.cs |
Integrated normalization into the query pipeline |
Comments suppressed due to low confidence (2)
test/System.Linq.Dynamic.Core.SystemTextJson.Tests/SystemTextJsonTests.cs:578
- This assignment to first is useless, since its value is never read.
var first = result.First();
test/System.Linq.Dynamic.Core.SystemTextJson.Tests/SystemTextJsonTests.cs:591
- This assignment to array is useless, since its value is never read.
var array = JsonDocument.Parse(data);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/System.Linq.Dynamic.Core.NewtonsoftJson/Config/NormalizationNonExistingPropertyBehavior.cs
Outdated
Show resolved
Hide resolved
src/System.Linq.Dynamic.Core.SystemTextJson/Config/SystemTextJsonParsingConfig.cs
Outdated
Show resolved
Hide resolved
src/System.Linq.Dynamic.Core.NewtonsoftJson/Config/NewtonsoftJsonParsingConfig.cs
Outdated
Show resolved
Hide resolved
src/System.Linq.Dynamic.Core.SystemTextJson/Utils/NormalizeUtils.cs
Outdated
Show resolved
Hide resolved
test/System.Linq.Dynamic.Core.SystemTextJson.Tests/SystemTextJsonTests.cs
Outdated
Show resolved
Hide resolved
…onNonExistingPropertyBehavior.cs Co-authored-by: Copilot <[email protected]>
…sonParsingConfig.cs Co-authored-by: Copilot <[email protected]>
…sonParsingConfig.cs Co-authored-by: Copilot <[email protected]>
…ls.cs Co-authored-by: Copilot <[email protected]>
No description provided.