gRPC SwaggerGen does not handle conflicting paths#64883
Closed
feiyun0112 wants to merge 1 commit intodotnet:mainfrom
Closed
gRPC SwaggerGen does not handle conflicting paths#64883feiyun0112 wants to merge 1 commit intodotnet:mainfrom
feiyun0112 wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where gRPC SwaggerGen incorrectly generates conflicting OpenAPI paths for HTTP transcoding patterns that use the same variable name with different literal path segments (e.g., /v1/{name=widgets/*} and /v1/{name=things/*}).
Key Changes:
- Modified path resolution logic to include literal segments from multi-segment route patterns in the generated OpenAPI paths
- Added comprehensive test coverage for Google AIP-131 style resource patterns
- Ensures unique OpenAPI paths are generated even when gRPC patterns use the same parameter name
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 |
|---|---|
GrpcJsonTranscodingDescriptionProvider.cs |
Updated ResolvePath method to expand multi-segment variables by including literal segments, ensuring unique OpenAPI paths |
resources.proto |
Added test proto file defining a ResourceService with three methods using patterns with different literal segments |
ResourceService.cs |
Added test service implementation inheriting from generated gRPC service base |
ResourcePathTests.cs |
Added test validating that conflicting patterns generate unique OpenAPI paths with correct parameter mappings |
Microsoft.AspNetCore.Grpc.Swagger.Tests.csproj |
Added reference to the new resources.proto file for code generation |
This was referenced Dec 29, 2025
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #64879