schema

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateOut

type GenerateOut struct {
	ParentSchemaName string
	Schemas          map[string]*openapi3.SchemaRef
	Examples         openapi3.Examples
}

type Generator

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

func NewGenerator

func NewGenerator(options ...Opt) (*Generator, error)

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context, structValue interface{}) (out GenerateOut, err error)

type Opt

type Opt func(*Generator) error

func WithGoTag

func WithGoTag(tags []string) Opt

WithGoTag will try to get the first non-empty field name based on Golang tag. For example, if you use ["json", "yaml"], then json tag will be used as field name if the value is not empty. If json tag is empty, then it will try using yaml tag name. If all the list is still return empty string, it will use golang default field name.

By default, this will use json tag.

func WithLog

func WithLog(writer io.Writer) Opt

WithLog enables debug log to see how Schema will be appended as final Schemas.

func WithSchemaPrefix

func WithSchemaPrefix(prefix string) Opt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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