protoc-gen-openapi: POST method with empty body generates a required `requestBody`
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 279
- PR merge metrics
- No merged PRs in 30d
Description
Hi there. When I'm writing a POST method with an empty request body, protoc-gen-openapi generates a required `requestBody`
```protobuf
rpc Logout(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/logout"
body: "*"
};
}
```
```yaml
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:
```bash
--openapi_out=required_request_body=true/false/only_nonempty:.
```
Contributor guide
Assessment
This issue has not been assessed yet.