templates

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalFunctions = map[string]interface{}{
	"refName":                refName,
	"mustValidate":           mustValidate,
	"mustValidateRecurse":    mustValidateRecurse,
	"keysReflect":            keysReflect,
	"httpStatus":             http.StatusText,
	"newData":                newData,
	"newDataRequired":        newDataRequired,
	"recurseData":            recurseData,
	"recurseDataSetRequired": recurseDataSetRequired,
}

GlobalFunctions for templates

Functions

func Load

func Load(generatorFuncs map[string]interface{}, dir fs.FS, files ...string) (*template.Template, error)

Load takes in funcs to apply to each template, a directory that contains the files, and the file paths relative that directory

Types

type TemplateData

type TemplateData struct {
	Spec   *openapi3spec.OpenAPI3
	Params map[string]string

	Imports map[string]struct{}

	Name     string
	Object   interface{}
	Required bool
}

TemplateData for all generators

func NewTemplateData

func NewTemplateData(spec *openapi3spec.OpenAPI3, params map[string]string) *TemplateData

NewTemplateData constructor

func NewTemplateDataWithObject

func NewTemplateDataWithObject(spec *openapi3spec.OpenAPI3, params map[string]string, name string, object interface{}, required bool) *TemplateData

NewTemplateDataWithObject constructor

func (TemplateData) Import

func (t TemplateData) Import(importName string) string

Import records the importing of a library

Jump to

Keyboard shortcuts

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