Exclude proto message fields from OpenAPI spec
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 279
- PR merge metrics
- No merged PRs in 30d
Description
Is it possible to exclude certain fields defined in a protobuf and its corresponding graph from the OpenAPI spec generated by https://github.com/google/gnostic/tree/master/apps/protoc-gen-openapi ?
Say the proto is
```
Message SomeProto {
string field_1 = 1;
AnotherProto field_2 = 2; // exclude this
}
// this proto should not be included in the OpenAPI spec
Message AnotherProto {
SomeMoreDepProto field = 1;
...
}
```
Currently, the OpenAPI spec defines all of these protos under the components->schemas
```
components:
schemas:
SomeProto:
properties:
field_1:
type: string
description: ''
field_2:
ref: $ref: '#/components/schemas/AnotherProto'
AnotherProto:
properties:
field_1:
ref: $ref: '#/components/schemas/SomeMoreDepProto'
```
`AnotherProto` and `SomeMoreDepProto` are internal protos that I cannot expose.
I need the OpenAPI spec to thus be
```
components:
schemas:
SomeProto:
properties:
field_1:
type: string
description: ''
```
Contributor guide
Assessment
This issue has not been assessed yet.