visitors

package
v5.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConjureDefinitionsByPackage

func ConjureDefinitionsByPackage(root spec.ConjureDefinition) (map[string]spec.ConjureDefinition, error)

func GetCustomConjureTypes

func GetCustomConjureTypes(typeDefinitions []spec.TypeDefinition, conjurePkgToGoPk func(string) string) (types.CustomConjureTypes, error)

func GetParamID

func GetParamID(argDef spec.ArgumentDefinition) string

GetParamID returns the parameter ID for the provided argument definition. If the provided definition is a header or query parameter and its ParamId field is non-empty, it is returned; otherwise, the argName is returned.

func GetPossibleCookieAuth

func GetPossibleCookieAuth(authType spec.AuthType) (*spec.CookieAuthType, error)

func GetPossibleHeaderAuth

func GetPossibleHeaderAuth(authType spec.AuthType) (*spec.HeaderAuthType, error)

func IsSpecificConjureType

func IsSpecificConjureType(rawType spec.Type, typeCheck TypeCheck) (bool, error)

func NewConjureTypeProviderTyper

func NewConjureTypeProviderTyper(rawType spec.Type, info types.PkgInfo) (types.Typer, error)

func StatementsForHTTPParam

func StatementsForHTTPParam(argName spec.ArgumentName, argType spec.Type, stringExpr astgen.ASTExpr, info types.PkgInfo) ([]astgen.ASTStmt, error)

StatementsForHTTPParam returns the AST statements converting an HTTP parameter (path/query/string) to the proper type. Supports generating statements for primitives and containers (set/list) of primitives.

func TypeNameToTyperName

func TypeNameToTyperName(typeName spec.TypeName) string

func VisitConjureDefinition

func VisitConjureDefinition(def spec.ConjureDefinition, visitor ConjureDefinitionVisitor) error

Types

type ArgumentDefinitionBodyParam

type ArgumentDefinitionBodyParam struct {
	ArgumentDefinition spec.ArgumentDefinition
	BodyParameterType  spec.BodyParameterType
}

func GetBodyParams

func GetBodyParams(argumentDefinitions []spec.ArgumentDefinition) ([]ArgumentDefinitionBodyParam, error)

type ArgumentDefinitionHeaderParam

type ArgumentDefinitionHeaderParam struct {
	ArgumentDefinition  spec.ArgumentDefinition
	HeaderParameterType spec.HeaderParameterType
}

func GetHeaderParams

func GetHeaderParams(argumentDefinitions []spec.ArgumentDefinition) ([]ArgumentDefinitionHeaderParam, error)

type ArgumentDefinitionPathParam

type ArgumentDefinitionPathParam struct {
	ArgumentDefinition spec.ArgumentDefinition
	PathParameterType  spec.PathParameterType
}

func GetPathParams

func GetPathParams(argumentDefinitions []spec.ArgumentDefinition) ([]ArgumentDefinitionPathParam, error)

type ArgumentDefinitionQueryParam

type ArgumentDefinitionQueryParam struct {
	ArgumentDefinition spec.ArgumentDefinition
	QueryParameterType spec.QueryParameterType
}

func GetQueryParams

func GetQueryParams(argumentDefinitions []spec.ArgumentDefinition) ([]ArgumentDefinitionQueryParam, error)

type AuthTypeFilterer

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

func (*AuthTypeFilterer) VisitCookie

func (a *AuthTypeFilterer) VisitCookie(v spec.CookieAuthType) error

func (*AuthTypeFilterer) VisitHeader

func (a *AuthTypeFilterer) VisitHeader(v spec.HeaderAuthType) error

func (*AuthTypeFilterer) VisitUnknown

func (a *AuthTypeFilterer) VisitUnknown(typeName string) error

type ConjureDefinitionVisitor

type ConjureDefinitionVisitor interface {
	spec.TypeDefinitionVisitor
	VisitError(v spec.ErrorDefinition) error
	VisitService(v spec.ServiceDefinition) error
}

type ConjureTypeFilterVisitor

type ConjureTypeFilterVisitor struct {
	AliasDefinitions  []spec.AliasDefinition
	EnumDefinitions   []spec.EnumDefinition
	ObjectDefinitions []spec.ObjectDefinition
	UnionDefinitions  []spec.UnionDefinition
}

func NewConjureTypeFilterVisitor

func NewConjureTypeFilterVisitor() *ConjureTypeFilterVisitor

func (*ConjureTypeFilterVisitor) VisitAlias

func (c *ConjureTypeFilterVisitor) VisitAlias(aliasDefinition spec.AliasDefinition) error

func (*ConjureTypeFilterVisitor) VisitEnum

func (c *ConjureTypeFilterVisitor) VisitEnum(enumDefinition spec.EnumDefinition) error

func (*ConjureTypeFilterVisitor) VisitObject

func (c *ConjureTypeFilterVisitor) VisitObject(objectDefinition spec.ObjectDefinition) error

func (*ConjureTypeFilterVisitor) VisitUnion

func (c *ConjureTypeFilterVisitor) VisitUnion(unionDefinition spec.UnionDefinition) error

func (*ConjureTypeFilterVisitor) VisitUnknown

func (c *ConjureTypeFilterVisitor) VisitUnknown(typeName string) error

type ConjureTypePackageCollector

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

func (*ConjureTypePackageCollector) VisitAlias

func (*ConjureTypePackageCollector) VisitEnum

func (*ConjureTypePackageCollector) VisitError

func (*ConjureTypePackageCollector) VisitObject

func (*ConjureTypePackageCollector) VisitService

func (*ConjureTypePackageCollector) VisitUnion

func (*ConjureTypePackageCollector) VisitUnknown

func (c *ConjureTypePackageCollector) VisitUnknown(typeName string) error

type ConjureTypeProvider

type ConjureTypeProvider interface {
	ParseType(info types.PkgInfo) (types.Typer, error)
	CollectionInitializationIfNeeded(info types.PkgInfo) (*expression.CallExpression, error)
	IsSpecificType(typeCheck TypeCheck) bool
}

func NewConjureTypeProvider

func NewConjureTypeProvider(rawType spec.Type) (ConjureTypeProvider, error)

type CustomTypesVisitor

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

func (*CustomTypesVisitor) VisitAlias

func (c *CustomTypesVisitor) VisitAlias(aliasDefinition spec.AliasDefinition) error

func (*CustomTypesVisitor) VisitEnum

func (c *CustomTypesVisitor) VisitEnum(enumDefinition spec.EnumDefinition) error

func (*CustomTypesVisitor) VisitObject

func (c *CustomTypesVisitor) VisitObject(objectDefinition spec.ObjectDefinition) error

func (*CustomTypesVisitor) VisitUnion

func (c *CustomTypesVisitor) VisitUnion(unionDefinition spec.UnionDefinition) error

func (*CustomTypesVisitor) VisitUnknown

func (c *CustomTypesVisitor) VisitUnknown(typeName string) error

type ParamIDVisitor

type ParamIDVisitor struct {
	ParamID spec.ParameterId
}

func (*ParamIDVisitor) VisitBody

func (p *ParamIDVisitor) VisitBody(v spec.BodyParameterType) error

func (*ParamIDVisitor) VisitHeader

func (p *ParamIDVisitor) VisitHeader(v spec.HeaderParameterType) error

func (*ParamIDVisitor) VisitPath

func (p *ParamIDVisitor) VisitPath(v spec.PathParameterType) error

func (*ParamIDVisitor) VisitQuery

func (p *ParamIDVisitor) VisitQuery(v spec.QueryParameterType) error

func (*ParamIDVisitor) VisitUnknown

func (p *ParamIDVisitor) VisitUnknown(typeName string) error

type ParamTypeFilterer

type ParamTypeFilterer struct {
	CurrentArgumentDefinition spec.ArgumentDefinition
	BodyParameterTypes        []ArgumentDefinitionBodyParam
	HeaderParameterTypes      []ArgumentDefinitionHeaderParam
	PathParameterTypes        []ArgumentDefinitionPathParam
	QueryParameterTypes       []ArgumentDefinitionQueryParam
}

func (*ParamTypeFilterer) VisitBody

func (p *ParamTypeFilterer) VisitBody(bodyParameterType spec.BodyParameterType) error

func (*ParamTypeFilterer) VisitHeader

func (p *ParamTypeFilterer) VisitHeader(headerParameterType spec.HeaderParameterType) error

func (*ParamTypeFilterer) VisitPath

func (p *ParamTypeFilterer) VisitPath(pathParameterType spec.PathParameterType) error

func (*ParamTypeFilterer) VisitQuery

func (p *ParamTypeFilterer) VisitQuery(queryParameterType spec.QueryParameterType) error

func (*ParamTypeFilterer) VisitUnknown

func (p *ParamTypeFilterer) VisitUnknown(typeName string) error

type TypeCheck

type TypeCheck string
const (
	IsText       TypeCheck = "TEXT" // anything serialized as a string
	IsOptional   TypeCheck = "OPTIONAL"
	IsBinary     TypeCheck = "BINARY"
	IsString     TypeCheck = "STRING"
	IsList       TypeCheck = "LIST"
	IsMap        TypeCheck = "MAP"
	IsSet        TypeCheck = "SET"
	IsBoolean    TypeCheck = "BOOLEAN"
	IsSafeMarker TypeCheck = "SAFE_MARKER"
)

Jump to

Keyboard shortcuts

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