generator

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2020 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeApplicationJson           string = "application/json"
	ContentTypeApplicationHalJson        string = "application/hal+json"
	ContentTypeMultipartFormData         string = "multipart/form-data"
	ContentTypeImagePng                  string = "image/png"
	ContentTypeImageJpeg                 string = "image/jpeg"
	ContentTypeImageTiff                 string = "image/tiff"
	ContentTypeImageWebp                 string = "image/webp"
	ContentTypeImageGif                  string = "image/gif"
	ContentTypeImageSvgXml               string = "image/svg+xml"
	ContentTypeImageXIcon                string = "image/x-icon"
	ContentTypeTextPlain                 string = "text/plain; charset=utf-8"
	ContentTypeTextHTML                  string = "text/html"
	ContentTypeApplicationFormUrlencoded string = "application/x-www-form-urlencoded"
	ContentTypeApplicationPDF            string = "application/pdf"
	ContentTypeApplicationXMLPattern     string = `^application\/(.+)xml$`
)

Variables

Functions

func GoProject

func GoProject(dir, pckg string) error

func NewGoClientGenerator

func NewGoClientGenerator(spec *openapi.Spec) *goClientGenerator

func NewGoHandlersGenerator

func NewGoHandlersGenerator(spec *openapi.Spec) *goHandlersGenerator

func NewGoServerGenerator

func NewGoServerGenerator(spec *openapi.Spec) *goServerGenerator

func NewGoServiceGenerator

func NewGoServiceGenerator(spec *openapi.Spec) *goServicesGenerator

func NewGoTypesGenerator

func NewGoTypesGenerator(spec *openapi.Spec) *goTypesGenerator

Types

type ApiGenerator

type ApiGenerator struct {
	// contains filtered or unexported fields
}

func (*ApiGenerator) Generate

func (gen *ApiGenerator) Generate(path, pkg string, generatePrometheus bool) error

type ApiMockGenerator

type ApiMockGenerator struct {
	ApiGenerator
}

func (*ApiMockGenerator) Generate

func (gen *ApiMockGenerator) Generate(path, pkg string, generatePrometheus bool) error

type ClientApiGenerator

type ClientApiGenerator struct {
	ApiGenerator
}

func (*ClientApiGenerator) Generate

func (gen *ClientApiGenerator) Generate(path, pkg string, generatePrometheus bool) error

type ClientApiMockGenerator

type ClientApiMockGenerator struct {
	ApiGenerator
}

func (*ClientApiMockGenerator) Generate

func (gen *ClientApiMockGenerator) Generate(path, pkg string, generatePrometheus bool) error

type Generator

type Generator interface {
	Generate(path string, pkg string, generatePrometheus bool) error
}

func NewGoAPIGenerator

func NewGoAPIGenerator(spec *openapi.Spec) Generator

func NewGoAPIMockGenerator

func NewGoAPIMockGenerator(spec *openapi.Spec) Generator

func NewGoClientAPIGenerator

func NewGoClientAPIGenerator(spec *openapi.Spec) Generator

func NewGoClientAPIMockGenerator

func NewGoClientAPIMockGenerator(spec *openapi.Spec) Generator

func NewGoServerAPIGenerator

func NewGoServerAPIGenerator(spec *openapi.Spec) Generator

func NewGoServerAPIMockGenerator

func NewGoServerAPIMockGenerator(spec *openapi.Spec) Generator

type GoClientMockGenerator

type GoClientMockGenerator struct {
	*GoGenerator
}

func NewGoClientMockGenerator

func NewGoClientMockGenerator(spec *openapi.Spec) *GoClientMockGenerator

func (*GoClientMockGenerator) Generate

func (gen *GoClientMockGenerator) Generate(path, pckg string) error

type GoGenerator

type GoGenerator struct {
	Spec *openapi.Spec
}

func NewGoGenerator

func NewGoGenerator(spec *openapi.Spec) *GoGenerator

func (*GoGenerator) ConvertMapToSecuritySchemeSlice

func (gen *GoGenerator) ConvertMapToSecuritySchemeSlice(security []map[string][]string) []spec.SecurityScheme

func (*GoGenerator) PopulateParametersBucket

func (gen *GoGenerator) PopulateParametersBucket(bucket *ParametersBucket, parameters []spec.Parameter, security []map[string][]string) (*ParametersBucket, error)

func (*GoGenerator) WalkOperations

func (gen *GoGenerator) WalkOperations(handler func(operation *Operation) error) error

type Library

type Library struct {
	Import string
	Alias  string
}

type Operation

type Operation struct {
	*spec.Operation
	Method   string
	Route    string
	Path     *spec.PathItem
	Produces []string
	Consumes []string
}

func (*Operation) HasConsume

func (o *Operation) HasConsume(c string) bool

func (*Operation) HasConsumes

func (o *Operation) HasConsumes(cs ...string) bool

func (*Operation) HasProduce

func (o *Operation) HasProduce(p string) bool

func (*Operation) HasProduces

func (o *Operation) HasProduces(ps ...string) bool

func (*Operation) HasValidConsumes

func (o *Operation) HasValidConsumes() bool

func (*Operation) HasValidProduces

func (o *Operation) HasValidProduces() bool

func (*Operation) RegexHasProduces

func (o *Operation) RegexHasProduces(pattern string) bool

type ParametersBucket

type ParametersBucket struct {
	Path          []*spec.Parameter
	Query         []*spec.Parameter
	Header        []*spec.Parameter
	FormData      []*spec.Parameter
	FormDataFiles []*spec.Parameter
	Security      []spec.SecurityScheme
	Body          []*spec.Parameter
	HasFormData   bool
	HasBody       bool
	HasURLEncoded bool
}

func NewParameterBucket

func NewParameterBucket(HasURLEncoded bool) *ParametersBucket

type ServerApiGenerator

type ServerApiGenerator struct {
	ApiGenerator
}

func (*ServerApiGenerator) Generate

func (gen *ServerApiGenerator) Generate(path, pkg string, generatePrometheus bool) error

type ServerApiMockGenerator

type ServerApiMockGenerator struct {
	ApiGenerator
}

func (*ServerApiMockGenerator) Generate

func (gen *ServerApiMockGenerator) Generate(path, pkg string, generatePrometheus bool) error

type ValidatorMap

type ValidatorMap map[string]string

func NewValidatorMap

func NewValidatorMap() ValidatorMap

func (ValidatorMap) Add

func (m ValidatorMap) Add(v *types.RegexValidator)

func (ValidatorMap) AddAll

func (m ValidatorMap) AddAll(v []*types.RegexValidator)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL