-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
base: main
Are you sure you want to change the base?
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 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 toGrpcJsonSettings
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);
Description
Add a
FieldNamesCaseInsensitive
setting to gRPC JSON transcoding.Fixes #50401