Documentation ¶
Overview ¶
Package generator translates an OpenAPIv3 specification into working go code that handles marshalling, error handling, parameter parsing and validation.
Index ¶
- type Generator
- func (g *Generator) BuildHandler(schema *openapi3.Swagger) error
- func (g *Generator) BuildSchema(schema *openapi3.Swagger, packagePath, packageName string) (string, error)
- func (g *Generator) BuildSource(source, packagePath, packageName string) (string, error)
- func (g *Generator) BuildTypes(schema *openapi3.Swagger) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator for go types, requests handler and simple validators for the given OpenAPIv3. The OpenAPIv3 schema is expected to comply with the json-api specification. Everything that doesn't comply to the json-api specification will be ignored during generation. The Generator doesn't validate necessarily.
func (*Generator) BuildHandler ¶
BuildHandler generates the request handlers based on gorilla mux
func (*Generator) BuildSchema ¶
func (g *Generator) BuildSchema(schema *openapi3.Swagger, packagePath, packageName string) (string, error)
BuildSchema generates the go code in the specified path with specified package name based on the passed schema
func (*Generator) BuildSource ¶
BuildSource generates the go code in the specified path with specified package name based on the passed schema source (url or file path)