-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Don't error on Protobuf messages that expose wrapper types #62871
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 Protobuf wrapper types in gRPC JSON transcoding by implementing conversion logic to handle scenarios where wrapper types are directly exposed on DTOs rather than their underlying primitive types.
- Adds detection and conversion logic for wrapper types (StringValue, Int32Value, etc.) in the JSON transcoding infrastructure
- Includes new test coverage for reading and writing JSON with wrapper type properties
- Adds a generated WrappersMessage test class to support the new functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
WrappersMessage.cs | Generated Protobuf message class containing all wrapper types for testing |
JsonConverterWriteTests.cs | Adds test for serializing wrapper types to JSON |
JsonConverterReadTests.cs | Adds test for deserializing JSON to wrapper types |
MessageTypeInfoResolver.cs | Core implementation for detecting and converting wrapper types during serialization/deserialization |
...rosoft.AspNetCore.Grpc.JsonTranscoding.Tests/TestObjects/ProtobutMessages/WrappersMessage.cs
Outdated
Show resolved
Hide resolved
...oding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/Json/MessageTypeInfoResolver.cs
Outdated
Show resolved
Hide resolved
...oding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/Json/MessageTypeInfoResolver.cs
Show resolved
Hide resolved
...oding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/Json/MessageTypeInfoResolver.cs
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Fixes #55254
Add logic to convert to and from wrapper types when they're exposed on Protobuf DTOs.
Note that the Protobuf DTO class is added directly instead of code genned. This is done because code gen in this project wouldn't expose the wrapper types.