gnostic
gnostic copied to clipboard
Exclude proto message fields from OpenAPI spec
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: ''
Tagging active members to seek attention - @timburks @ppaanngggg
as I know, it is impossible now