Skip to content

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

Merged
merged 5 commits into from
Jul 24, 2025

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 23, 2025

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.

@JamesNK JamesNK added the area-grpc Includes: GRPC wire-up, templates label Jul 23, 2025
@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 02:14
@JamesNK JamesNK requested a review from captainsafia as a code owner July 23, 2025 02:14
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 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

@JamesNK JamesNK added this to the 10.0-preview7 milestone Jul 23, 2025
@JamesNK JamesNK enabled auto-merge (squash) July 23, 2025 23:21
@JamesNK
Copy link
Member Author

JamesNK commented Jul 24, 2025

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@JamesNK JamesNK merged commit 2ec9740 into main Jul 24, 2025
30 checks passed
@JamesNK JamesNK deleted the jamesnk/json-transcoding-wrapper-types branch July 24, 2025 07:29
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.

gRPC JSON transcoding google.protobuf.WellKnownTypes response/request cast error
2 participants