Documentation ¶
Overview ¶
Package gen for generate OpenAPI specification from proto.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶
CamelCase was copied from https://github.com/golang/protobuf/blob/v1.5.2/protoc-gen-go/generator/generator.go#L2648 CamelCase returns the CamelCased name. If there is an interior underscore followed by a lower case letter, drop the underscore and convert the letter to upper case. There is a remote possibility of this rewrite causing a name collision, but it's so remote we're prepared to pretend it's nonexistent - since the C++ generator lowercases names, it's extremely unlikely to have two fields with different capitalizations. In short, _my_field_name_2 becomes XMyFieldName_2.
func Capitalize ¶
Capitalize converts first character to upper.
If the string is invalid UTF-8 or empty, it is returned as is.
func LowerCamelCase ¶
LowerCamelCase returns the lowerCamelCased name.
func Uncapitalize ¶ added in v0.2.0
Uncapitalize converts first character to lower.
If the string is invalid UTF-8 or empty, it is returned as is.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator instance.
func NewGenerator ¶
func NewGenerator(files []*protogen.File, opts ...GeneratorOption) (*Generator, error)
NewGenerator returns new Generator instance.
type GeneratorOption ¶
type GeneratorOption func(g *Generator)
GeneratorOption is option for Generator.
func WithSpecInfoDescription ¶
func WithSpecInfoDescription(description string) GeneratorOption
WithSpecInfoDescription sets description.
func WithSpecInfoTitle ¶
func WithSpecInfoTitle(title string) GeneratorOption
WithSpecInfoTitle sets title.
func WithSpecInfoVersion ¶
func WithSpecInfoVersion(version string) GeneratorOption
WithSpecInfoVersion sets version.
func WithSpecOpenAPI ¶
func WithSpecOpenAPI(openapi string) GeneratorOption
WithSpecOpenAPI sets openapi.
type InvalidPathTemplateError ¶
type InvalidPathTemplateError struct { // Msg is error message. Msg string // At is byte position. At int }
InvalidPathTemplateError is a path template parsing error.
func (*InvalidPathTemplateError) Error ¶
func (e *InvalidPathTemplateError) Error() string
Error implements error.
type PathSegment ¶
PathSegment is a OpenAPI path segment.
func (PathSegment) IsParam ¶
func (p PathSegment) IsParam() bool
IsParam whether is segment defines a path parameter.