generator

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT, MIT Imports: 14 Imported by: 0

README

Limitations of the Api Generation

  • Security Schemes of type apiKey should not use the Authorization-Header, if more than one security scheme is used for any endpoint. Otherwise it is not possible to choose the right Authorization scheme for each request

Documentation

Overview

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

Index

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

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

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

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

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

BuildTypes transforms all component schemas into go types

Jump to

Keyboard shortcuts

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