gnostic
gnostic copied to clipboard
protoc-gen-openapi: POST method with empty body generates a required `requestBody`
Hi there. When I'm writing a POST method with an empty request body, protoc-gen-openapi generates a required requestBody
rpc Logout(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/logout"
body: "*"
};
}
paths:
/api/logout:
post:
requestBody:
content:
application/json: {}
required: true
Required empty body causes exceptions on swagger-ui. And I'm not sure which side is the problem.
Is it possible to provide an option to set requestBody.required? Like this:
--openapi_out=required_request_body=true/false/only_nonempty:.
I think that we need to have switch case for such proto type and generate proper openapi without additional option