Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Protocols = []Protocol{ { Name: "json", ContentType: "application/json", }, { Name: "proto", ContentType: "application/proto", IsBinary: true, }, { Name: "connect+json", ContentType: "application/connect+json", RequestDesc: "The request is JSON with Connect protocol framing to support streaming RPCs. See the [Connect Protocol](https://connectrpc.com/docs/protocol) for more.", ResponseDesc: "The response is JSON with Connect protocol framing to support streaming RPCs. See the [Connect Protocol](https://connectrpc.com/docs/protocol) for more.", IsStreaming: true, IsBinary: true, }, { Name: "connect+proto", ContentType: "application/connect+proto", RequestDesc: "The request is binary-encoded protobuf with Connect protocol framing to support streaming RPCs. See the [Connect Protocol](https://connectrpc.com/docs/protocol) for more.", ResponseDesc: "The response is binary-encoded protobuf with Connect protocol framing to support streaming RPCs. See the [Connect Protocol](https://connectrpc.com/docs/protocol) for more.", IsStreaming: true, IsBinary: true, }, { Name: "grpc", ContentType: "application/grpc", RequestDesc: "The request is uses the gRPC protocol. See the [the gRPC documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) for more.", ResponseDesc: "The response is uses the gRPC protocol. See the [the gRPC documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) for more.", IsStreaming: true, IsBinary: true, }, { Name: "grpc+proto", ContentType: "application/grpc+proto", RequestDesc: "The request is uses the gRPC protocol. See the [the gRPC documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) for more.", ResponseDesc: "The response is uses the gRPC protocol. See the [the gRPC documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) for more.", IsStreaming: true, IsBinary: true, }, { Name: "grpc+json", ContentType: "application/grpc+json", RequestDesc: "The request is uses the gRPC protocol but with JSON encoding. See the [the gRPC documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) for more.", ResponseDesc: "The response is uses the gRPC protocol but with JSON encoding. See the [the gRPC documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) for more.", IsStreaming: true, IsBinary: true, }, { Name: "grpc-web", ContentType: "application/grpc-web", RequestDesc: "The request is uses the gRPC-Web protocol. See the [the gRPC-Web documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) for more.", ResponseDesc: "The response is uses the gRPC-Web protocol. See the [the gRPC-Web documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) for more.", IsStreaming: true, IsBinary: true, }, { Name: "grpc-web+proto", ContentType: "application/grpc-web+proto", RequestDesc: "The request is uses the gRPC-Web protocol. See the [the gRPC-Web documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) for more.", ResponseDesc: "The response is uses the gRPC-Web protocol. See the [the gRPC-Web documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) for more.", IsStreaming: true, IsBinary: true, }, { Name: "grpc-web+json", ContentType: "application/grpc-web+json", RequestDesc: "The request is uses the gRPC-Web protocol but with JSON encoding. See the [the gRPC-Web documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) for more.", ResponseDesc: "The response is uses the gRPC-Web protocol but with JSON encoding. See the [the gRPC-Web documentation](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) for more.", IsStreaming: true, IsBinary: true, }, }
Functions ¶
func IsValidContentType ¶ added in v0.10.0
Types ¶
type FieldAnnotator ¶ added in v0.15.22
type FieldAnnotator interface {
AnnotateField(opts Options, schema *base.Schema, desc protoreflect.FieldDescriptor, onlyScalar bool) *base.Schema
}
type FieldReferenceAnnotator ¶ added in v0.15.22
type FieldReferenceAnnotator interface { // Annotate a field reference. This takes in the PARENT of the field, because with references // we can only annotate on the things on the parent like the list of required attributes. AnnotateFieldReference(opts Options, parent *base.Schema, desc protoreflect.FieldDescriptor) *base.Schema }
type MessageAnnotator ¶ added in v0.15.22
type MessageAnnotator interface {
AnnotateMessage(opts Options, schema *base.Schema, desc protoreflect.MessageDescriptor) *base.Schema
}
type Options ¶
type Options struct { // Format is either 'yaml' or 'json' and is the format of the output OpenAPI file(s). Format string // BaseOpenAPI is the file contents of a base OpenAPI file. BaseOpenAPI []byte // WithStreaming will content types related to streaming (warning: can be messy). WithStreaming bool // AllowGET will let methods with `idempotency_level = NO_SIDE_EFFECTS` to be documented with GET requests. AllowGET bool // ContentTypes is a map of all content types. Available values are in Protocols. ContentTypes map[string]struct{} // Debug enables debug logging if set to true. Debug bool // IncludeNumberEnumValues indicates if numbers are included for enum values in addition to the string representations. IncludeNumberEnumValues bool // WithProtoNames indicates if protobuf field names should be used instead of JSON names. WithProtoNames bool // Path is the output OpenAPI path. Path string // PathPrefix is a prefix that is prepended to every HTTP path. PathPrefix string // TrimUnusedTypes will remove types that aren't referenced by a service. TrimUnusedTypes bool // WithProtoAnnotations will add some protobuf annotations for descriptions WithProtoAnnotations bool // FullyQualifiedMessageNames uses the full path for message types: {pkg}.{name} instead of just the name. This // is helpful if you are mixing types from multiple services. FullyQualifiedMessageNames bool // WithServiceDescriptions set to true will cause service names and their comments to be added to the end of info.description. WithServiceDescriptions bool // IgnoreGoogleapiHTTP set to true will cause service to always generate OpenAPI specs for connect endpoints, and ignore any google.api.http options. IgnoreGoogleapiHTTP bool // Services filters which services will be used for generating OpenAPI spec. Services []protoreflect.FullName MessageAnnotator MessageAnnotator FieldAnnotator FieldAnnotator FieldReferenceAnnotator FieldReferenceAnnotator }
func FromString ¶ added in v0.10.0
func NewOptions ¶ added in v0.10.0
func NewOptions() Options
func (Options) HasService ¶ added in v0.15.4
func (opts Options) HasService(serviceName protoreflect.FullName) bool
Click to show internal directories.
Click to hide internal directories.