schemagen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomizerFunc

type CustomizerFunc = func(obj any, sf *reflect.StructField, typ reflect.Type, s *schema.Schema) (string, reflect.Kind, bool)

CustomizerFunc is a function used to customize a schema. It returns an optional function name, the amended kind and a bool determining if the field should be skipped.

type DocsFunc

type DocsFunc = func(obj any, sf reflect.StructField) string

DocsFunc is a function that returns the documentation for a struct field.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator generates Terraform schemas.

func New

func New(docsFn DocsFunc, customizerFn CustomizerFunc, tag string) *Generator

New returns a schema generator.

func (*Generator) ResolveName

func (g *Generator) ResolveName(sf reflect.StructField) string

ResolveName resolves the name of a field.

func (*Generator) Struct

func (g *Generator) Struct(obj any) (map[string]string, error)

Struct generates the schema from the given object.

Jump to

Keyboard shortcuts

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