bricks: github.com/pace/bricks/http/jsonapi/generator Index | Files

package generator

import "github.com/pace/bricks/http/jsonapi/generator"

Package generator translates an OpenAPIv3 specification into working go code that handles marshalling, error handling, parameter parsing and validation.

Index

Package Files

doc.go generate.go generate_handler.go generate_helper.go generate_security.go generate_types.go route.go

type Generator Uses

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 Uses

func (g *Generator) BuildHandler(schema *openapi3.Swagger) error

BuildHandler generates the request handlers based on gorilla mux

func (*Generator) BuildSchema Uses

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 Uses

func (g *Generator) BuildSource(source, packagePath, packageName string) (string, error)

BuildSource generates the go code in the specified path with specified package name based on the passed schema source (url or file path)

func (*Generator) BuildTypes Uses

func (g *Generator) BuildTypes(schema *openapi3.Swagger) error

BuildTypes transforms all component schemas into go types

Package generator imports 14 packages (graph) and is imported by 1 packages. Updated 2020-12-01. Refresh now. Tools for package owners.