scanner

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XID           = "x-id"
	XGoVendorType = `x-go-vendor-type`
	XGoStarLevel  = `x-go-star-level`
	XGoFieldName  = `x-go-field-name`

	XTagValidate = `x-tag-validate`
	XTagMime     = `x-tag-mime`
	XTagJSON     = `x-tag-json`
	XTagXML      = `x-tag-xml`
	XTagName     = `x-tag-name`

	XEnumOptions = `x-enum-options`
	XStatusErrs  = `x-status-errors`
)

Variables

This section is empty.

Functions

func ParseEnum

func ParseEnum(doc string) (string, bool)

func ParseStatusErrMsg

func ParseStatusErrMsg(s string) (string, bool)

func ParseStringFormat

func ParseStringFormat(doc string) (string, string)

func ParseType

func ParseType(typeExpr ast.Expr) (keyType, pkgName string, pointer bool)

func RetrievePackageName

func RetrievePackageName(path string) string

func StringifyCommentGroup

func StringifyCommentGroup(commentGroupList ...*ast.CommentGroup) (comments string)

Types

type ByCommentPos

type ByCommentPos []*ast.CommentGroup

func (ByCommentPos) Len

func (a ByCommentPos) Len() int

func (ByCommentPos) Less

func (a ByCommentPos) Less(i, j int) bool

func (ByCommentPos) Swap

func (a ByCommentPos) Swap(i, j int)

type CommentScanner

type CommentScanner struct {
	CommentMap ast.CommentMap
	// contains filtered or unexported fields
}

func NewCommentScanner

func NewCommentScanner(fileSet *token.FileSet, file *ast.File) *CommentScanner

func (*CommentScanner) CommentGroupListOf

func (scanner *CommentScanner) CommentGroupListOf(targetNode ast.Node) (commentGroupList []*ast.CommentGroup)

func (*CommentScanner) CommentsOf

func (scanner *CommentScanner) CommentsOf(targetNode ast.Node) string

type DefinitionScanner

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

func NewDefinitionScanner

func NewDefinitionScanner(pkg *packagex.Package) *DefinitionScanner

func (*DefinitionScanner) BindSchemas

func (scanner *DefinitionScanner) BindSchemas(openapi *oas.OpenAPI)

func (*DefinitionScanner) Def

func (scanner *DefinitionScanner) Def(typeName *types.TypeName) *oas.Schema

func (*DefinitionScanner) GetSchemaByType

func (scanner *DefinitionScanner) GetSchemaByType(typ types.Type) *oas.Schema

type EnumScanner

type EnumScanner struct {
	EnumSet map[*types.TypeName][]enumeration.EnumOption
	// contains filtered or unexported fields
}

func NewEnumScanner

func NewEnumScanner(pkg *packagex.Package) *EnumScanner

func (*EnumScanner) Enum

func (scanner *EnumScanner) Enum(typeName *types.TypeName) []enumeration.EnumOption

func (*EnumScanner) HasOffset

func (scanner *EnumScanner) HasOffset(typeName *types.TypeName) bool

type Operator

type Operator struct {
	transport_http.RouteMeta

	Tag         string
	Description string

	NonBodyParameters map[string]*oas.Parameter
	RequestBody       *oas.RequestBody

	StatusErrors      []*status_error.StatusError
	StatusErrorSchema *oas.Schema

	SuccessStatus   int
	SuccessType     types.Type
	SuccessResponse *oas.Response
}

func (*Operator) AddNonBodyParameter

func (operator *Operator) AddNonBodyParameter(parameter *oas.Parameter)

func (*Operator) BindOperation

func (operator *Operator) BindOperation(method string, operation *oas.Operation, last bool)

func (*Operator) SetRequestBody

func (operator *Operator) SetRequestBody(requestBody *oas.RequestBody)

type OperatorScanner

type OperatorScanner struct {
	*DefinitionScanner
	*StatusErrScanner
	// contains filtered or unexported fields
}

func NewOperatorScanner

func NewOperatorScanner(pkg *packagex.Package) *OperatorScanner

func (*OperatorScanner) Operator

func (scanner *OperatorScanner) Operator(typeName *types.TypeName) *Operator

type OperatorWithTypeName

type OperatorWithTypeName struct {
	*Operator
	TypeName *types.TypeName
}

func (*OperatorWithTypeName) String

func (operator *OperatorWithTypeName) String() string

type Route

type Route struct {
	Operators []*OperatorWithTypeName
	// contains filtered or unexported fields
}

func (*Route) Method

func (route *Route) Method() string

func (*Route) Path

func (route *Route) Path() string

func (*Route) String

func (route *Route) String() string

type Router

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

func NewRouter

func NewRouter(typeVar *types.Var, operators ...*OperatorWithTypeName) *Router

func (*Router) AppendOperators

func (router *Router) AppendOperators(operators ...*OperatorWithTypeName)

func (*Router) Name

func (router *Router) Name() string

func (*Router) Register

func (router *Router) Register(r *Router)

func (*Router) Route

func (router *Router) Route() *Route

func (*Router) Routes

func (router *Router) Routes() (routes []*Route)

func (*Router) String

func (router *Router) String() string

func (*Router) With

func (router *Router) With(operators ...*OperatorWithTypeName)

type RouterScanner

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

func NewRouterScanner

func NewRouterScanner(pkg *packagex.Package) *RouterScanner

func (*RouterScanner) OperatorScanner

func (scanner *RouterScanner) OperatorScanner() *OperatorScanner

func (*RouterScanner) OperatorTypeNameFromType

func (scanner *RouterScanner) OperatorTypeNameFromType(typ types.Type) *OperatorWithTypeName

func (*RouterScanner) OperatorTypeNamesFromArgs

func (scanner *RouterScanner) OperatorTypeNamesFromArgs(pkg *packagex.Package, args ...ast.Expr) []*OperatorWithTypeName

func (*RouterScanner) Router

func (scanner *RouterScanner) Router(typeName *types.Var) *Router

type SchemaRefer

type SchemaRefer struct {
	*oas.Schema
}

func NewSchemaRefer

func NewSchemaRefer(s *oas.Schema) *SchemaRefer

func (SchemaRefer) RefString

func (r SchemaRefer) RefString() string

type StatusErrScanner

type StatusErrScanner struct {
	StatusErrType *types.Named
	// contains filtered or unexported fields
}

func NewStatusErrScanner

func NewStatusErrScanner(pkg *packagex.Package) *StatusErrScanner

func (*StatusErrScanner) StatusErrorsInFunc

func (scanner *StatusErrScanner) StatusErrorsInFunc(typeFunc *types.Func) []*status_error.StatusError

type StatusErrorScanner

type StatusErrorScanner struct {
	StatusErrors map[*types.TypeName][]*status_error.StatusError
	// contains filtered or unexported fields
}

func NewStatusErrorScanner

func NewStatusErrorScanner(pkg *packagex.Package) *StatusErrorScanner

func (*StatusErrorScanner) StatusError

func (scanner *StatusErrorScanner) StatusError(typeName *types.TypeName) []*status_error.StatusError

type StructFieldUniqueChecker

type StructFieldUniqueChecker map[string]*types.Var

func (StructFieldUniqueChecker) Check

func (checker StructFieldUniqueChecker) Check(structType *types.Struct, anonymous bool) error

type VendorExtensible

type VendorExtensible interface {
	AddExtension(key string, value interface{})
}

Jump to

Keyboard shortcuts

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