v2

package
v0.0.0-...-f55f069 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalTemplate = `` /* 241-byte string literal not displayed */
View Source
const RecordTemplate = `` /* 169-byte string literal not displayed */

Variables

This section is empty.

Functions

func GenerateOpenApi

func GenerateOpenApi(p *Parser, s IType) spec.Schema

func PrintSwagger

func PrintSwagger(p *Parser) spec.Swagger

func PrintTsTypes

func PrintTsTypes(parser *Parser, w io.Writer)

Types

type BaseType

type BaseType struct {
	Doc     string
	Package string
	Name    string
	T       reflect.Type // indirect type
}

func (*BaseType) GetName

func (this *BaseType) GetName() string

func (*BaseType) GetPackage

func (this *BaseType) GetPackage() string

func (*BaseType) GetType

func (this *BaseType) GetType() reflect.Type

func (*BaseType) IsType

func (*BaseType) IsType()

func (*BaseType) RefName

func (this *BaseType) RefName() string

func (*BaseType) SetName

func (this *BaseType) SetName(s, pkg string)

type EnumDef

type EnumDef struct {
	BaseType
	Values []EnumValue
}

func (*EnumDef) IsType

func (*EnumDef) IsType()

type EnumValue

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

func (*EnumValue) Stringify

func (this *EnumValue) Stringify() string

type Fn

type Fn = func(t IType)

type IType

type IType interface {
	IsType()
	GetName() string
	SetName(name, pkg string)
	GetPackage() string
	RefName() string
	GetType() reflect.Type
}

type Package

type Package struct {
	Name  string
	Types []IType
}

type ParseResult

type ParseResult struct {
	FieldName string
	FieldType string
	Ignore    bool
	State     PropertyState
}

func ParseStructTag

func ParseStructTag(structTag reflect.StructTag) (*ParseResult, error)

type Parser

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

func NewFromRawTypes

func NewFromRawTypes(types ...RawType) *Parser

func NewFromTypes

func NewFromTypes(types ...interface{}) *Parser

func (*Parser) GetVisited

func (this *Parser) GetVisited(t reflect.Type) IType

func (*Parser) Parse

func (this *Parser) Parse(rawTypes ...RawType)

type PkgParseResult

type PkgParseResult struct {
	Packages *packages.Package
	Docs     *doc.Package
}

func GetPackages

func GetPackages(pkgName string) (*PkgParseResult, error)

type PropertyState

type PropertyState int
const (
	Auto PropertyState = iota
	Ignored
	Optional
	Null
	NotNull
)

type RawType

type RawType struct {
	T reflect.Type
}

type RecordDef

type RecordDef struct {
	BaseType
	Fields   []*RecordField
	Embedded []reflect.Type
}

func (*RecordDef) IsType

func (*RecordDef) IsType()

type RecordField

type RecordField struct {
	Doc   string
	Key   string
	Tag   *ParseResult
	Type  reflect.Type
	IsRef bool
}

func (*RecordField) IsType

func (*RecordField) IsType()

type TypeDef

type TypeDef struct {
	BaseType
}

type TypeToString

type TypeToString = func(t reflect.Type) string

Jump to

Keyboard shortcuts

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