Skip to content

Add gRPC JSON transcoding option for case insensitive field names #62868

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 22, 2025

Description

Add a FieldNamesCaseInsensitive setting to gRPC JSON transcoding.

Fixes #50401

@Copilot Copilot AI review requested due to automatic review settings July 22, 2025 23:26
@JamesNK JamesNK requested a review from captainsafia as a code owner July 22, 2025 23:26
@JamesNK JamesNK added the area-grpc Includes: GRPC wire-up, templates label Jul 22, 2025
Copy link
Contributor

@Copilot 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 a FieldNamesCaseInsensitive option to the gRPC JSON transcoding feature, allowing case-insensitive matching of field names during JSON deserialization.

Key changes:

  • Added a new FieldNamesCaseInsensitive boolean property to GrpcJsonSettings class
  • Modified the JSON serializer configuration to respect the case-insensitive setting
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
GrpcJsonSettings.cs Added the new FieldNamesCaseInsensitive property with documentation explaining interoperability concerns
JsonConverterHelper.cs Updated to configure PropertyNameCaseInsensitive based on the new setting
MessageTypeInfoResolver.cs Removed unused import statement
JsonConverterReadTests.cs Added extensive test cases to verify case-insensitive field matching behavior
transcoding.proto Added test message type for field name case testing
Comments suppressed due to low confidence (1)

src/Grpc/JsonTranscoding/test/Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests/ConverterTests/JsonConverterReadTests.cs:515

  • This test case for MapKeyBool_CaseInsensitive is missing the settings parameter to enable case-insensitive matching. It should include settings: new GrpcJsonSettings { FieldNamesCaseInsensitive = true } to properly test the case-insensitive functionality.
        AssertReadJson<HelloRequest>(json, serializeOld: false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-grpc Includes: GRPC wire-up, templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make PropertyNameCaseInsensitive available for JSON->gRPC transcoding
2 participants