grpc-ecosystem/grpc-gateway
View on GitHubprotoc-gen-openapiv2: don't emit body objects containing only nested path parameters
Open
#2624 opened on Apr 4, 2022
buggood first issuehelp wantedopenapi
Description
🚀 Feature
When path parameters are all part of a message in the body protoc-gen-openapiv2 emits a body property that is an empty object. While technically the field id is selected by body: "*" its sole field value is a path parameter and id is emitted as body object without properties.
service EntityService {
rpc DeleteEntity(DeleteEntityRequest) returns (DeleteEntityResponse) {
option (google.api.http) = {
delete: "/entities/{id.value}"
body: "*"
};
}
}
// message Entity {
// EntityId id = 1;
// etc.
// }
message EntityId {
string value = 1;
}
message DeleteEntityRequest {
EntityId id = 1;
string other_field = 2;
}
message DeleteEntityResponse {}
"/entities/{id.value}": {
"delete": {
"operationId": "EntityService_DeleteEntity",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/testingDeleteEntityResponse"
}
}
},
"parameters": [
{
"name": "id.value",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"id": {
"type": "object" <---
},
"otherField": {
"type": "string"
}
}
}
}
]
}
}