Skip to content

Conversation

@StefH
Copy link
Collaborator

@StefH StefH commented Nov 15, 2025

No description provided.

@StefH StefH self-assigned this Nov 15, 2025
@StefH StefH added the feature label Nov 15, 2025
@StefH StefH changed the title Support normalization of objects when for Z.DynamicLinq.Json Support normalization of objects for Z.DynamicLinq.Json Nov 15, 2025
@StefH StefH requested a review from Copilot November 15, 2025 09:19
Copilot finished reviewing on behalf of StefH November 15, 2025 09:21
Copy link
Contributor

Copilot AI left a 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 Normalize property to configuration classes with default value of true
  • Added NormalizationNonExistingPropertyBehavior enum 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants