The swagger plugin couldn’t distinguish two rpcs if we use the resource name design style. #702
Closed
Description
The swagger plugin couldn’t distinguish two rpcs designed according to the Google API Design Guide Resource Names as below:
rpc GetService(GetServiceRequest) returns (Service) {
option (google.api.http) = {
get: "/v1/{name=service_categories/*/services/*}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
description: "Get a service.The **name** must have the format of `service_categories/*/services/*`.";
tags: "Service";
};
}
rpc GetUser(GetUserRequest) returns (User) {
option (google.api.http) = {
get: "/v1/{name=users/*}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
description: "Get a user.The **name** must have the format of `users/*`.";
tags: "User";
};
}
The two generated results from the swagger plugin both use the /v1/{name}
as the key.
There is no problem if we use ID
as the user input, but according to the Google API Design Guide the name
is a better choice.
Is there any solution about this issue?
Metadata
Assignees
Labels
No labels