Documentation ¶
Index ¶
- Variables
- func Deref(ptr any) any
- func HTTPStatus(code int) string
- func KeysReflect(mp any) ([]string, error)
- func Load(generatorFuncs map[string]any, dir fs.FS, files ...string) (*template.Template, error)
- func MustValidate(s *openapi3spec.Schema) bool
- func MustValidateRecurse(s *openapi3spec.Schema) bool
- func RefName(ref string) string
- type TemplateData
- func NewData(old TemplateData, name string, obj any) TemplateData
- func NewDataRequired(old TemplateData, name string, obj any, required bool) TemplateData
- func NewTemplateData(spec *openapi3spec.OpenAPI3, params map[string]string) *TemplateData
- func NewTemplateDataWithObject(spec *openapi3spec.OpenAPI3, params map[string]string, name string, object any, ...) *TemplateData
- func RecurseData(old TemplateData, nextName string, nextObj any) TemplateData
- func RecurseDataSetRequired(old TemplateData, nextName string, nextObj any, required bool) TemplateData
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalFunctions = map[string]any{ "refName": RefName, "mustValidate": MustValidate, "mustValidateRecurse": MustValidateRecurse, "keysReflect": KeysReflect, "httpStatus": HTTPStatus, "newData": NewData, "newDataRequired": NewDataRequired, "recurseData": RecurseData, "recurseDataSetRequired": RecurseDataSetRequired, "deref": Deref, }
GlobalFunctions for templates
Functions ¶
func HTTPStatus ¶
func KeysReflect ¶
func Load ¶
Load takes in funcs to apply to each template, a directory that contains the files, and the file paths relative that directory
func MustValidate ¶
func MustValidate(s *openapi3spec.Schema) bool
MustValidate checks to see if the schema requires any kind of validation
func MustValidateRecurse ¶
func MustValidateRecurse(s *openapi3spec.Schema) bool
MustValidateRecurse checks to see if the current schema, or any sub-schema requires validation
Types ¶
type TemplateData ¶
type TemplateData struct { Spec *openapi3spec.OpenAPI3 Params map[string]string Imports map[string]struct{} Name string Object any Required bool }
TemplateData for all generators
func NewData ¶
func NewData(old TemplateData, name string, obj any) TemplateData
func NewDataRequired ¶
func NewDataRequired(old TemplateData, name string, obj any, required bool) TemplateData
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 any, required bool) *TemplateData
NewTemplateDataWithObject constructor
func RecurseData ¶
func RecurseData(old TemplateData, nextName string, nextObj any) TemplateData
func RecurseDataSetRequired ¶
func RecurseDataSetRequired(old TemplateData, nextName string, nextObj any, required bool) TemplateData
func (TemplateData) Import ¶
func (t TemplateData) Import(importName string) string
Import records the importing of a library
func (TemplateData) TemplateParamEquals ¶
func (t TemplateData) TemplateParamEquals(param, want string) bool
TemplateParamEquals checks for equality of a parameter
func (TemplateData) TemplateParamExists ¶
func (t TemplateData) TemplateParamExists(param string) bool
TemplateParamExists checks for existence of a parameter
Click to show internal directories.
Click to hide internal directories.