generator

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRoot

func GenerateRoot(opts *GeneratorOptions, f *jen.File, schemas ...*jsonschema.Schema) error

GenerateRoot generates the root struct and all its children

schema: the inputed root schema
f: the result root go AST, which may render to a file, is a return value

Types

type Generator

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

func NewGenerator

func NewGenerator(opts *GeneratorOptions, schemas ...*jsonschema.Schema) (*Generator, error)

func (*Generator) GenerateDef

func (g *Generator) GenerateDef(schema *jsonschema.Schema, file *jen.File)

func (*Generator) SchemaTypeName

func (g *Generator) SchemaTypeName(schema *jsonschema.Schema) string

type GeneratorOptions

type GeneratorOptions struct {
	// will not generate additional properties and pattern properties by default
	WithAdditionalProperties bool
	// will apply the upper case rule to the property names
	UpperPropertyNames []string
}

type RefResolver

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

func NewRefResolver

func NewRefResolver(schemas []*jsonschema.Schema) (*RefResolver, error)

func (*RefResolver) GetSchemaByReference

func (r *RefResolver) GetSchemaByReference(schema *jsonschema.Schema) (*jsonschema.Schema, error)

GetSchemaByReference returns the schema.

Jump to

Keyboard shortcuts

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