goserver

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultPackage name for go
	DefaultPackage = "oa3gen"
	// Disclaimer printed to the top of Go files
	Disclaimer = `` /* 149-byte string literal not displayed */

)
View Source
const (
	ParamKeyPackage     = "package"
	ParamKeyTimeType    = "timetype"
	ParamKeyUUIDType    = "uuidtype"
	ParamKeyDecimalType = "decimaltype"
)

Constants for keys recognized in the parameters for the Go server

Variables

View Source
var TemplateFunctions = map[string]any{
	"camelSnake":          camelSnake,
	"filterNonIdentChars": filterNonIdentChars,
	"isInlinePrimitive":   isInlinePrimitive,
	"omitnullWrap":        omitnullWrap,
	"omitnullUnwrap":      omitnullUnwrap,
	"omitnullIsWrapped":   omitnullIsWrapped,
	"paramConvertFn":      paramConvertFn,
	"paramRequiresType":   paramRequiresType,
	"paramSchemaName":     paramSchemaName,
	"paramTypeName":       paramTypeName,
	"primitive":           primitive,
	"primitiveBits":       primitiveBits,
	"primitiveWrapped":    primitiveWrapped,
	"responseKind":        responseKind,
	"snakeToCamel":        snakeToCamel,
	"taggedPaths":         tagPaths,
	"hasComplexServers":   hasComplexServers,
	"hasJSONResponse":     hasJSONResponse,
	"responseTypeName":    responseTypeName,
	"responseNeedsWrap":   responseNeedsWrap,
	"responseNeedsPtr":    responseNeedsPtr,
	"responseRefName":     responseRefName,

	"mustValidate":        mustValidate,
	"mustValidateRecurse": mustValidateRecurse,
}

TemplateFunctions to use for generation

View Source
var TemplateList = []string{
	"api_interface.tpl",
	"api_methods.tpl",
	"responses.tpl",
	"schema.tpl",
	"schema_top.tpl",

	"validate_schema.tpl",
	"validate_field.tpl",
}

templates for generation

Functions

func GenerateTopLevelSchemas added in v0.0.24

func GenerateTopLevelSchemas(spec *openapi3spec.OpenAPI3, params map[string]string, tpl *template.Template) ([]generator.File, error)

GenerateSchemas creates files for the topLevel-level referenceable types

Some supported Inline are also generated. Prefixed with their recursive names and Inline. components.responses[name].headers[headername].schema components.responses[name].content[mime-type].schema components.responses[name].content[mime-type].encoding[propname].headers[headername].schema components.parameters[name].schema components.requestBodies[name].content[mime-type].schema components.requestBodies[name].content[mime-type].encoding[propname].headers[headername].schema components.headers[name].schema paths.parameters[0].schema paths.(get|put...).parameters[0].schema paths.(get|put...).requestBody.content[mime-type].schema paths.(get|put...).responses[name].headers[headername].schema paths.(get|put...).responses[name].content[mime-type].schema paths.(get|put...).responses[name].content[mime-type].encoding[propname].headers[headername].schema

func Imports added in v0.0.24

func Imports(imps map[string]struct{}) string

func New

func New() generator.Interface

New go generator

Types

This section is empty.

Jump to

Keyboard shortcuts

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