gencode

package
v0.0.0-...-b99e8af Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplatesFS embed.FS

Embed the templates directory

Functions

func FilterGoImport

func FilterGoImport(str string) string

func FilterGoType

func FilterGoType(str string) string

func Generate

func Generate(spec *openapi3.T, opts codegen.Configuration) (string, error)

func GenerateModels

func GenerateModels(specFile string, destDir string, opts codegen.Configuration) error

func GenerateTests

func GenerateTests(srcFile string, destDir string, opts Config) error

func LoadSwagger

func LoadSwagger(filePath string) (swagger *openapi3.T, err error)

func LoadTemplates

func LoadTemplates(src embed.FS, t *template.Template) error

func MakeJsonSchemaFromYaml

func MakeJsonSchemaFromYaml(filePath string) ([]byte, error)

func PascalFrom_snake_case

func PascalFrom_snake_case(snake_case string) string

func PubCapitalize

func PubCapitalize(str string) string

func SanitizeCode

func SanitizeCode(goCode string) string

Types

type Config

type Config struct {
	Options string // TODO: fill in fields as needed
}

type Payload

type Payload struct {
	SchemaName     string
	ModuleName     string
	Package        string
	GenVersion     string
	SpecVersion    string
	SpecFile       string
	GoSchema       codegen.Schema
	Imports        []string
	PubFieldLookup map[string]string
	PubFieldName   func(string) string
	FilterGoType   func(string) string
	FilterGoImport func(string) string
}

Jump to

Keyboard shortcuts

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