http_rest

package
v0.0.0-...-f1bff1d Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(v SpecVisitor, m interface{}) Cont

Visits m with v.

func ApplyPair

func ApplyPair(v SpecPairVisitor, left, right interface{}) Cont

Visits left and right with v in tandem.

func ApplyPairWithContext

func ApplyPairWithContext(v SpecPairVisitor, c SpecPairVisitorContext, left, right interface{}) Cont

Visits left and right with v in context c, in tandem.

func DefaultVisitIRChildren

func DefaultVisitIRChildren(ctx Context, vm VisitorManager, m interface{}) Cont

This is the default implementation of VisitNodeChildren for DefaultSpecVisitorImpl. It is indirectly called by every Visit____Children that does not override the default method.

We need to call the visitor manager on:

Every exported field in a struct, after updating the context with EnterStruct.
Every element of an array, after updating the context with EnterArray.
Every element of a map, after updating the context with EnterMap.

Each call to visit may abort the operation.

This implementation uses reflection as a fallback, but has specialized methods for common types. GRPC types use the fallback.

It looks like the original implementation would call EnterNode/VisitChildren/LeaveNode on basic types. We won't be doing that, as specVisitor's enter/visitChildren/leave methods do not do anything with them.

func GetNormalizedArgNames

func GetNormalizedArgNames(args map[string]*pb.Data, methodMeta *pb.HTTPMethodMeta) (map[ArgName]string, error)

Returns a normalization map for the keys in the given method-argument map. The return value maps normalized keys to keys in the given map.

In IR method objects, arguments to requests and responses are indexed by the arguments' hashes. However, because arguments are not normalized, equivalent arguments can have different hashes, so these indices are not useful for determining whether and how a method has changed.

func GetPrimitiveType

func GetPrimitiveType(p *pb.Primitive) reflect.Type

func GetPrimitiveValue

func GetPrimitiveValue(p *pb.Primitive) string

func VisitInterface

func VisitInterface(c Context, vm VisitorManager, m interface{}) Cont

Visits the node m of any type, whose context is c. This should never return SkipChildren. Implements all the logic to enter, visit children, and leave, while obeying the visitor's returned Cont value. This is a copy of astVisitor's visit function.

Types

type ArgName

type ArgName interface {
	String() string
	// contains filtered or unexported methods
}

Represents the "name" of an argument to a method.

type ArrayElement

type ArrayElement struct {
	Index int
	// contains filtered or unexported fields
}

Identifies an element of an array.

func NewArrayElement

func NewArrayElement(index int) *ArrayElement

func (*ArrayElement) IsArrayElement

func (elt *ArrayElement) IsArrayElement() bool

func (*ArrayElement) IsFieldName

func (elt *ArrayElement) IsFieldName() bool

func (*ArrayElement) IsMapKeyType

func (elt *ArrayElement) IsMapKeyType() bool

func (*ArrayElement) IsMapValueType

func (elt *ArrayElement) IsMapValueType() bool

func (*ArrayElement) IsOneOfVariant

func (elt *ArrayElement) IsOneOfVariant() bool

func (*ArrayElement) IsOptionalType

func (elt *ArrayElement) IsOptionalType() bool

func (*ArrayElement) String

func (ae *ArrayElement) String() string

type DefaultContextlessSpecVisitorImpl

type DefaultContextlessSpecVisitorImpl struct {
	DefaultSpecVisitorImpl
}

func (*DefaultContextlessSpecVisitorImpl) NewContext

type DefaultSpecPairVisitor

type DefaultSpecPairVisitor interface {
	SpecPairVisitor

	EnterNodes(self interface{}, ctxt SpecPairVisitorContext, left, right interface{}) Cont

	VisitNodeChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right interface{}) Cont

	LeaveNodes(self interface{}, ctxt SpecPairVisitorContext, left, right interface{}, cont Cont) Cont
}

A SpecPairVisitor with methods for providing default visiting behaviour.

type DefaultSpecPairVisitorImpl

type DefaultSpecPairVisitorImpl struct{}

func (*DefaultSpecPairVisitorImpl) DefaultVisitChildren

func (*DefaultSpecPairVisitorImpl) DefaultVisitChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right interface{}) Cont

func (*DefaultSpecPairVisitorImpl) EnterAPISpecs

func (*DefaultSpecPairVisitorImpl) EnterAPISpecs(self interface{}, c SpecPairVisitorContext, left, right *pb.APISpec) Cont

func (*DefaultSpecPairVisitorImpl) EnterData

func (*DefaultSpecPairVisitorImpl) EnterData(self interface{}, c SpecPairVisitorContext, left, right *pb.Data) Cont

func (*DefaultSpecPairVisitorImpl) EnterDataMetas

func (*DefaultSpecPairVisitorImpl) EnterDataMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.DataMeta) Cont

func (*DefaultSpecPairVisitorImpl) EnterDifferentTypes

func (*DefaultSpecPairVisitorImpl) EnterDifferentTypes(self interface{}, c SpecPairVisitorContext, left, right interface{}) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPAuths

func (*DefaultSpecPairVisitorImpl) EnterHTTPAuths(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPAuth) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPBodies

func (*DefaultSpecPairVisitorImpl) EnterHTTPBodies(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPBody) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPCookies

func (*DefaultSpecPairVisitorImpl) EnterHTTPCookies(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPCookie) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPEmpties

func (*DefaultSpecPairVisitorImpl) EnterHTTPEmpties(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPEmpty) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPHeaders

func (*DefaultSpecPairVisitorImpl) EnterHTTPHeaders(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPHeader) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPMetas

func (*DefaultSpecPairVisitorImpl) EnterHTTPMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPMeta) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPMethodMetas

func (*DefaultSpecPairVisitorImpl) EnterHTTPMethodMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPMethodMeta) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPMultiparts

func (*DefaultSpecPairVisitorImpl) EnterHTTPMultiparts(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPMultipart) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPPaths

func (*DefaultSpecPairVisitorImpl) EnterHTTPPaths(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPPath) Cont

func (*DefaultSpecPairVisitorImpl) EnterHTTPQueries

func (*DefaultSpecPairVisitorImpl) EnterHTTPQueries(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPQuery) Cont

func (*DefaultSpecPairVisitorImpl) EnterLists

func (*DefaultSpecPairVisitorImpl) EnterLists(self interface{}, c SpecPairVisitorContext, left, right *pb.List) Cont

func (*DefaultSpecPairVisitorImpl) EnterMethodMetas

func (*DefaultSpecPairVisitorImpl) EnterMethodMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.MethodMeta) Cont

func (*DefaultSpecPairVisitorImpl) EnterMethods

func (*DefaultSpecPairVisitorImpl) EnterMethods(self interface{}, c SpecPairVisitorContext, left, right *pb.Method) Cont

func (*DefaultSpecPairVisitorImpl) EnterNodes

func (*DefaultSpecPairVisitorImpl) EnterNodes(self interface{}, ctxt SpecPairVisitorContext, left, right interface{}) Cont

func (*DefaultSpecPairVisitorImpl) EnterOneOfs

func (*DefaultSpecPairVisitorImpl) EnterOneOfs(self interface{}, c SpecPairVisitorContext, left, right *pb.OneOf) Cont

func (*DefaultSpecPairVisitorImpl) EnterOptionals

func (*DefaultSpecPairVisitorImpl) EnterOptionals(self interface{}, c SpecPairVisitorContext, left, right *pb.Optional) Cont

func (*DefaultSpecPairVisitorImpl) EnterPrimitives

func (*DefaultSpecPairVisitorImpl) EnterPrimitives(self interface{}, c SpecPairVisitorContext, left, right *pb.Primitive) Cont

func (*DefaultSpecPairVisitorImpl) EnterStructs

func (*DefaultSpecPairVisitorImpl) EnterStructs(self interface{}, c SpecPairVisitorContext, left, right *pb.Struct) Cont

func (*DefaultSpecPairVisitorImpl) LeaveAPISpecs

func (*DefaultSpecPairVisitorImpl) LeaveAPISpecs(self interface{}, c SpecPairVisitorContext, left, right *pb.APISpec, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveData

func (*DefaultSpecPairVisitorImpl) LeaveData(self interface{}, c SpecPairVisitorContext, left, right *pb.Data, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveDataMetas

func (*DefaultSpecPairVisitorImpl) LeaveDataMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.DataMeta, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveDifferentTypes

func (*DefaultSpecPairVisitorImpl) LeaveDifferentTypes(self interface{}, c SpecPairVisitorContext, left, right interface{}, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPAuths

func (*DefaultSpecPairVisitorImpl) LeaveHTTPAuths(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPAuth, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPBodies

func (*DefaultSpecPairVisitorImpl) LeaveHTTPBodies(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPBody, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPCookies

func (*DefaultSpecPairVisitorImpl) LeaveHTTPCookies(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPCookie, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPEmpties

func (*DefaultSpecPairVisitorImpl) LeaveHTTPEmpties(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPEmpty, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPHeaders

func (*DefaultSpecPairVisitorImpl) LeaveHTTPHeaders(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPHeader, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPMetas

func (*DefaultSpecPairVisitorImpl) LeaveHTTPMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPMeta, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPMethodMetas

func (*DefaultSpecPairVisitorImpl) LeaveHTTPMethodMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPMethodMeta, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPMultiparts

func (*DefaultSpecPairVisitorImpl) LeaveHTTPMultiparts(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPMultipart, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPPaths

func (*DefaultSpecPairVisitorImpl) LeaveHTTPPaths(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPPath, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveHTTPQueries

func (*DefaultSpecPairVisitorImpl) LeaveHTTPQueries(self interface{}, c SpecPairVisitorContext, left, right *pb.HTTPQuery, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveLists

func (*DefaultSpecPairVisitorImpl) LeaveLists(self interface{}, c SpecPairVisitorContext, left, right *pb.List, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveMethodMetas

func (*DefaultSpecPairVisitorImpl) LeaveMethodMetas(self interface{}, c SpecPairVisitorContext, left, right *pb.MethodMeta, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveMethods

func (*DefaultSpecPairVisitorImpl) LeaveMethods(self interface{}, c SpecPairVisitorContext, left, right *pb.Method, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveNodes

func (*DefaultSpecPairVisitorImpl) LeaveNodes(self interface{}, ctxt SpecPairVisitorContext, left, right interface{}, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveOneOfs

func (*DefaultSpecPairVisitorImpl) LeaveOneOfs(self interface{}, c SpecPairVisitorContext, left, right *pb.OneOf, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveOptionals

func (*DefaultSpecPairVisitorImpl) LeaveOptionals(self interface{}, c SpecPairVisitorContext, left, right *pb.Optional, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeavePrimitives

func (*DefaultSpecPairVisitorImpl) LeavePrimitives(self interface{}, c SpecPairVisitorContext, left, right *pb.Primitive, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) LeaveStructs

func (*DefaultSpecPairVisitorImpl) LeaveStructs(self interface{}, c SpecPairVisitorContext, left, right *pb.Struct, cont Cont) Cont

func (*DefaultSpecPairVisitorImpl) VisitAPISpecChildren

func (*DefaultSpecPairVisitorImpl) VisitAPISpecChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.APISpec) Cont

func (*DefaultSpecPairVisitorImpl) VisitDataChildren

func (*DefaultSpecPairVisitorImpl) VisitDataChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Data) Cont

func (*DefaultSpecPairVisitorImpl) VisitDataMetaChildren

func (*DefaultSpecPairVisitorImpl) VisitDataMetaChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.DataMeta) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPAuthChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPAuthChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPAuth) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPBodyChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPBodyChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPBody) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPCookieChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPCookieChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPCookie) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPEmptyChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPEmptyChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPEmpty) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPHeaderChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPHeaderChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPHeader) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPMetaChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPMetaChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPMeta) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPMethodMetaChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPMethodMetaChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPMethodMeta) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPMultipartChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPMultipartChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPMultipart) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPPathChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPPathChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPPath) Cont

func (*DefaultSpecPairVisitorImpl) VisitHTTPQueryChildren

func (*DefaultSpecPairVisitorImpl) VisitHTTPQueryChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPQuery) Cont

func (*DefaultSpecPairVisitorImpl) VisitListChildren

func (*DefaultSpecPairVisitorImpl) VisitListChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.List) Cont

func (*DefaultSpecPairVisitorImpl) VisitMethodArgs

func (*DefaultSpecPairVisitorImpl) VisitMethodArgs(self interface{}, ctxt PairContext, vm PairVisitorManager, leftArgs, rightArgs map[string]*pb.Data) Cont

func (*DefaultSpecPairVisitorImpl) VisitMethodChildren

func (*DefaultSpecPairVisitorImpl) VisitMethodChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Method) Cont

Need to do special casing here, since the keys used in the method's Args and Responses do not reliably identify an arg or response.

func (*DefaultSpecPairVisitorImpl) VisitMethodMetaChildren

func (*DefaultSpecPairVisitorImpl) VisitMethodMetaChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.MethodMeta) Cont

func (*DefaultSpecPairVisitorImpl) VisitNodeChildren

func (*DefaultSpecPairVisitorImpl) VisitNodeChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right interface{}) Cont

func (*DefaultSpecPairVisitorImpl) VisitOneOfChildren

func (*DefaultSpecPairVisitorImpl) VisitOneOfChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.OneOf) Cont

func (*DefaultSpecPairVisitorImpl) VisitOptionalChildren

func (*DefaultSpecPairVisitorImpl) VisitOptionalChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Optional) Cont

func (*DefaultSpecPairVisitorImpl) VisitPrimitiveChildren

func (*DefaultSpecPairVisitorImpl) VisitPrimitiveChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Primitive) Cont

func (*DefaultSpecPairVisitorImpl) VisitStructChildren

func (*DefaultSpecPairVisitorImpl) VisitStructChildren(self interface{}, c SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Struct) Cont

type DefaultSpecVisitor

type DefaultSpecVisitor interface {
	SpecVisitor

	EnterNode(self interface{}, ctxt SpecVisitorContext, node interface{}) Cont
	VisitNodeChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node interface{}) Cont
	LeaveNode(self interface{}, ctxt SpecVisitorContext, node interface{}, cont Cont) Cont
}

A SpecVisitor with methods for providing default visiting behaviour.

type DefaultSpecVisitorImpl

type DefaultSpecVisitorImpl struct{}

Defines nops for all visitor methods in SpecVisitor.

func (*DefaultSpecVisitorImpl) DefaultVisitChildren

func (*DefaultSpecVisitorImpl) DefaultVisitChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, node interface{}) Cont

func (*DefaultSpecVisitorImpl) EnterAPISpec

func (*DefaultSpecVisitorImpl) EnterAPISpec(self interface{}, c SpecVisitorContext, spec *pb.APISpec) Cont

func (*DefaultSpecVisitorImpl) EnterData

func (*DefaultSpecVisitorImpl) EnterData(self interface{}, c SpecVisitorContext, d *pb.Data) Cont

func (*DefaultSpecVisitorImpl) EnterDataMeta

func (*DefaultSpecVisitorImpl) EnterDataMeta(self interface{}, c SpecVisitorContext, d *pb.DataMeta) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPAuth

func (*DefaultSpecVisitorImpl) EnterHTTPAuth(self interface{}, c SpecVisitorContext, a *pb.HTTPAuth) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPBody

func (*DefaultSpecVisitorImpl) EnterHTTPBody(self interface{}, c SpecVisitorContext, b *pb.HTTPBody) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPCookie

func (*DefaultSpecVisitorImpl) EnterHTTPCookie(self interface{}, c SpecVisitorContext, ck *pb.HTTPCookie) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPEmpty

func (*DefaultSpecVisitorImpl) EnterHTTPEmpty(self interface{}, c SpecVisitorContext, e *pb.HTTPEmpty) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPHeader

func (*DefaultSpecVisitorImpl) EnterHTTPHeader(self interface{}, c SpecVisitorContext, b *pb.HTTPHeader) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPMeta

func (*DefaultSpecVisitorImpl) EnterHTTPMeta(self interface{}, c SpecVisitorContext, m *pb.HTTPMeta) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPMethodMeta

func (*DefaultSpecVisitorImpl) EnterHTTPMethodMeta(self interface{}, c SpecVisitorContext, m *pb.HTTPMethodMeta) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPMultipart

func (*DefaultSpecVisitorImpl) EnterHTTPMultipart(self interface{}, c SpecVisitorContext, m *pb.HTTPMultipart) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPPath

func (*DefaultSpecVisitorImpl) EnterHTTPPath(self interface{}, c SpecVisitorContext, p *pb.HTTPPath) Cont

func (*DefaultSpecVisitorImpl) EnterHTTPQuery

func (*DefaultSpecVisitorImpl) EnterHTTPQuery(self interface{}, c SpecVisitorContext, q *pb.HTTPQuery) Cont

func (*DefaultSpecVisitorImpl) EnterList

func (*DefaultSpecVisitorImpl) EnterList(self interface{}, c SpecVisitorContext, d *pb.List) Cont

func (*DefaultSpecVisitorImpl) EnterMethod

func (*DefaultSpecVisitorImpl) EnterMethod(self interface{}, c SpecVisitorContext, m *pb.Method) Cont

func (*DefaultSpecVisitorImpl) EnterMethodMeta

func (*DefaultSpecVisitorImpl) EnterMethodMeta(self interface{}, c SpecVisitorContext, m *pb.MethodMeta) Cont

func (*DefaultSpecVisitorImpl) EnterNode

func (*DefaultSpecVisitorImpl) EnterNode(self interface{}, ctxt SpecVisitorContext, node interface{}) Cont

func (*DefaultSpecVisitorImpl) EnterOneOf

func (*DefaultSpecVisitorImpl) EnterOneOf(self interface{}, c SpecVisitorContext, d *pb.OneOf) Cont

func (*DefaultSpecVisitorImpl) EnterOptional

func (*DefaultSpecVisitorImpl) EnterOptional(self interface{}, c SpecVisitorContext, d *pb.Optional) Cont

func (*DefaultSpecVisitorImpl) EnterPrimitive

func (*DefaultSpecVisitorImpl) EnterPrimitive(self interface{}, c SpecVisitorContext, d *pb.Primitive) Cont

func (*DefaultSpecVisitorImpl) EnterStruct

func (*DefaultSpecVisitorImpl) EnterStruct(self interface{}, c SpecVisitorContext, d *pb.Struct) Cont

func (*DefaultSpecVisitorImpl) LeaveAPISpec

func (*DefaultSpecVisitorImpl) LeaveAPISpec(self interface{}, c SpecVisitorContext, spec *pb.APISpec, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveData

func (*DefaultSpecVisitorImpl) LeaveData(self interface{}, c SpecVisitorContext, d *pb.Data, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveDataMeta

func (*DefaultSpecVisitorImpl) LeaveDataMeta(self interface{}, c SpecVisitorContext, d *pb.DataMeta, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPAuth

func (*DefaultSpecVisitorImpl) LeaveHTTPAuth(self interface{}, c SpecVisitorContext, a *pb.HTTPAuth, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPBody

func (*DefaultSpecVisitorImpl) LeaveHTTPBody(self interface{}, c SpecVisitorContext, b *pb.HTTPBody, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPCookie

func (*DefaultSpecVisitorImpl) LeaveHTTPCookie(self interface{}, c SpecVisitorContext, ck *pb.HTTPCookie, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPEmpty

func (*DefaultSpecVisitorImpl) LeaveHTTPEmpty(self interface{}, c SpecVisitorContext, e *pb.HTTPEmpty, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPHeader

func (*DefaultSpecVisitorImpl) LeaveHTTPHeader(self interface{}, c SpecVisitorContext, b *pb.HTTPHeader, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPMeta

func (*DefaultSpecVisitorImpl) LeaveHTTPMeta(self interface{}, c SpecVisitorContext, m *pb.HTTPMeta, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPMethodMeta

func (*DefaultSpecVisitorImpl) LeaveHTTPMethodMeta(self interface{}, c SpecVisitorContext, m *pb.HTTPMethodMeta, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPMultipart

func (*DefaultSpecVisitorImpl) LeaveHTTPMultipart(self interface{}, c SpecVisitorContext, m *pb.HTTPMultipart, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPPath

func (*DefaultSpecVisitorImpl) LeaveHTTPPath(self interface{}, c SpecVisitorContext, p *pb.HTTPPath, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveHTTPQuery

func (*DefaultSpecVisitorImpl) LeaveHTTPQuery(self interface{}, c SpecVisitorContext, q *pb.HTTPQuery, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveList

func (*DefaultSpecVisitorImpl) LeaveList(self interface{}, c SpecVisitorContext, d *pb.List, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveMethod

func (*DefaultSpecVisitorImpl) LeaveMethod(self interface{}, c SpecVisitorContext, m *pb.Method, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveMethodMeta

func (*DefaultSpecVisitorImpl) LeaveMethodMeta(self interface{}, c SpecVisitorContext, m *pb.MethodMeta, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveNode

func (*DefaultSpecVisitorImpl) LeaveNode(self interface{}, ctxt SpecVisitorContext, node interface{}, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveOneOf

func (*DefaultSpecVisitorImpl) LeaveOneOf(self interface{}, c SpecVisitorContext, d *pb.OneOf, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveOptional

func (*DefaultSpecVisitorImpl) LeaveOptional(self interface{}, c SpecVisitorContext, d *pb.Optional, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeavePrimitive

func (*DefaultSpecVisitorImpl) LeavePrimitive(self interface{}, c SpecVisitorContext, d *pb.Primitive, cont Cont) Cont

func (*DefaultSpecVisitorImpl) LeaveStruct

func (*DefaultSpecVisitorImpl) LeaveStruct(self interface{}, c SpecVisitorContext, d *pb.Struct, cont Cont) Cont

func (*DefaultSpecVisitorImpl) NewContext

func (*DefaultSpecVisitorImpl) VisitAPISpecChildren

func (*DefaultSpecVisitorImpl) VisitAPISpecChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, spec *pb.APISpec) Cont

func (*DefaultSpecVisitorImpl) VisitDataChildren

func (*DefaultSpecVisitorImpl) VisitDataChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.Data) Cont

func (*DefaultSpecVisitorImpl) VisitDataMetaChildren

func (*DefaultSpecVisitorImpl) VisitDataMetaChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.DataMeta) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPAuthChildren

func (*DefaultSpecVisitorImpl) VisitHTTPAuthChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, a *pb.HTTPAuth) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPBodyChildren

func (*DefaultSpecVisitorImpl) VisitHTTPBodyChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, b *pb.HTTPBody) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPCookieChildren

func (*DefaultSpecVisitorImpl) VisitHTTPCookieChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, ck *pb.HTTPCookie) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPEmptyChildren

func (*DefaultSpecVisitorImpl) VisitHTTPEmptyChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, e *pb.HTTPEmpty) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPHeaderChildren

func (*DefaultSpecVisitorImpl) VisitHTTPHeaderChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, b *pb.HTTPHeader) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPMetaChildren

func (*DefaultSpecVisitorImpl) VisitHTTPMetaChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, m *pb.HTTPMeta) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPMethodMetaChildren

func (*DefaultSpecVisitorImpl) VisitHTTPMethodMetaChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, m *pb.HTTPMethodMeta) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPMultipartChildren

func (*DefaultSpecVisitorImpl) VisitHTTPMultipartChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, m *pb.HTTPMultipart) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPPathChildren

func (*DefaultSpecVisitorImpl) VisitHTTPPathChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, p *pb.HTTPPath) Cont

func (*DefaultSpecVisitorImpl) VisitHTTPQueryChildren

func (*DefaultSpecVisitorImpl) VisitHTTPQueryChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, q *pb.HTTPQuery) Cont

func (*DefaultSpecVisitorImpl) VisitListChildren

func (*DefaultSpecVisitorImpl) VisitListChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.List) Cont

func (*DefaultSpecVisitorImpl) VisitMethodChildren

func (*DefaultSpecVisitorImpl) VisitMethodChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, m *pb.Method) Cont

func (*DefaultSpecVisitorImpl) VisitMethodMetaChildren

func (*DefaultSpecVisitorImpl) VisitMethodMetaChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, m *pb.MethodMeta) Cont

func (*DefaultSpecVisitorImpl) VisitNodeChildren

func (*DefaultSpecVisitorImpl) VisitNodeChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node interface{}) Cont

func (*DefaultSpecVisitorImpl) VisitOneOfChildren

func (*DefaultSpecVisitorImpl) VisitOneOfChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.OneOf) Cont

func (*DefaultSpecVisitorImpl) VisitOptionalChildren

func (*DefaultSpecVisitorImpl) VisitOptionalChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.Optional) Cont

func (*DefaultSpecVisitorImpl) VisitPrimitiveChildren

func (*DefaultSpecVisitorImpl) VisitPrimitiveChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.Primitive) Cont

func (*DefaultSpecVisitorImpl) VisitStructChildren

func (*DefaultSpecVisitorImpl) VisitStructChildren(self interface{}, c SpecVisitorContext, vm VisitorManager, d *pb.Struct) Cont

type DummyVisitorContext

type DummyVisitorContext struct{}

func NewDummyVisitorContext

func NewDummyVisitorContext() *DummyVisitorContext

func (*DummyVisitorContext) EnterArray

func (c *DummyVisitorContext) EnterArray(arrayNode interface{}, elementIndex int) visitors.Context

func (*DummyVisitorContext) EnterMapValue

func (c *DummyVisitorContext) EnterMapValue(mapNode, mapKey interface{}) visitors.Context

func (*DummyVisitorContext) EnterStruct

func (c *DummyVisitorContext) EnterStruct(structNode interface{}, fieldName string) visitors.Context

func (*DummyVisitorContext) GetArgPath

func (*DummyVisitorContext) GetArgPath() []string

func (*DummyVisitorContext) GetContentType

func (*DummyVisitorContext) GetContentType() *string

func (*DummyVisitorContext) GetEndpointPath

func (*DummyVisitorContext) GetEndpointPath() string

func (*DummyVisitorContext) GetFieldPath

func (*DummyVisitorContext) GetFieldPath() []FieldPathElement

func (*DummyVisitorContext) GetHost

func (*DummyVisitorContext) GetHost() string

func (*DummyVisitorContext) GetHttpAuthType

func (*DummyVisitorContext) GetHttpAuthType() *pb.HTTPAuth_HTTPAuthType

func (*DummyVisitorContext) GetInnermostNode

func (*DummyVisitorContext) GetInnermostNode(reflect.Type) (interface{}, SpecVisitorContext)

func (*DummyVisitorContext) GetOuter

func (*DummyVisitorContext) GetOuter() visitors.Context

func (*DummyVisitorContext) GetPath

func (*DummyVisitorContext) GetResponseCode

func (*DummyVisitorContext) GetResponseCode() *string

func (*DummyVisitorContext) GetResponsePath

func (*DummyVisitorContext) GetResponsePath() []string

func (*DummyVisitorContext) GetRestOperation

func (*DummyVisitorContext) GetRestOperation() string

func (*DummyVisitorContext) GetRestPath

func (*DummyVisitorContext) GetRestPath() []string

func (*DummyVisitorContext) GetValueType

func (*DummyVisitorContext) GetValueType() HttpValueType

func (*DummyVisitorContext) IsArg

func (*DummyVisitorContext) IsArg() bool

func (*DummyVisitorContext) IsOptional

func (*DummyVisitorContext) IsOptional() bool

func (*DummyVisitorContext) IsResponse

func (*DummyVisitorContext) IsResponse() bool

type FieldName

type FieldName struct {
	Name string
	// contains filtered or unexported fields
}

Identifies a field of an object.

func NewFieldName

func NewFieldName(name string) *FieldName

func (*FieldName) IsArrayElement

func (elt *FieldName) IsArrayElement() bool

func (*FieldName) IsFieldName

func (elt *FieldName) IsFieldName() bool

func (*FieldName) IsMapKeyType

func (elt *FieldName) IsMapKeyType() bool

func (*FieldName) IsMapValueType

func (elt *FieldName) IsMapValueType() bool

func (*FieldName) IsOneOfVariant

func (elt *FieldName) IsOneOfVariant() bool

func (*FieldName) IsOptionalType

func (elt *FieldName) IsOptionalType() bool

func (*FieldName) String

func (f *FieldName) String() string

type FieldPathElement

type FieldPathElement interface {
	String() string

	IsFieldName() bool
	IsArrayElement() bool
	IsOneOfVariant() bool
	IsMapKeyType() bool
	IsMapValueType() bool
}

A path element for identifying the location of a field. See SpecVisitorContext.GetFieldLocation.

type HttpValueType

type HttpValueType int

Describes which part of an HTTP request/response a value belongs to.

const (
	UNKNOWN HttpValueType = iota
	PATH
	QUERY
	HEADER
	COOKIE
	BODY
	AUTH
)

func (HttpValueType) String

func (t HttpValueType) String() string

type MapKeyType

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

Identifies a map's key type.

func NewMapKeyType

func NewMapKeyType() *MapKeyType

func (*MapKeyType) IsArrayElement

func (elt *MapKeyType) IsArrayElement() bool

func (*MapKeyType) IsFieldName

func (elt *MapKeyType) IsFieldName() bool

func (*MapKeyType) IsMapKeyType

func (elt *MapKeyType) IsMapKeyType() bool

func (*MapKeyType) IsMapValueType

func (elt *MapKeyType) IsMapValueType() bool

func (*MapKeyType) IsOneOfVariant

func (elt *MapKeyType) IsOneOfVariant() bool

func (*MapKeyType) IsOptionalType

func (elt *MapKeyType) IsOptionalType() bool

func (*MapKeyType) String

func (mk *MapKeyType) String() string

type MapValueType

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

Identifies a map's value type.

func NewMapValueType

func NewMapValueType() *MapValueType

func (*MapValueType) IsArrayElement

func (elt *MapValueType) IsArrayElement() bool

func (*MapValueType) IsFieldName

func (elt *MapValueType) IsFieldName() bool

func (*MapValueType) IsMapKeyType

func (elt *MapValueType) IsMapKeyType() bool

func (*MapValueType) IsMapValueType

func (elt *MapValueType) IsMapValueType() bool

func (*MapValueType) IsOneOfVariant

func (elt *MapValueType) IsOneOfVariant() bool

func (*MapValueType) IsOptionalType

func (elt *MapValueType) IsOptionalType() bool

func (*MapValueType) String

func (mv *MapValueType) String() string

type OneOfVariant

type OneOfVariant struct {

	// Identifies the variant being represented.
	Index int

	// The number of possible variants.
	NumVariants int
	// contains filtered or unexported fields
}

Identifies a branch of a variant ("one of").

func NewOneOfVariant

func NewOneOfVariant(index int, numVariants int) *OneOfVariant

func (*OneOfVariant) IsArrayElement

func (elt *OneOfVariant) IsArrayElement() bool

func (*OneOfVariant) IsFieldName

func (elt *OneOfVariant) IsFieldName() bool

func (*OneOfVariant) IsMapKeyType

func (elt *OneOfVariant) IsMapKeyType() bool

func (*OneOfVariant) IsMapValueType

func (elt *OneOfVariant) IsMapValueType() bool

func (*OneOfVariant) IsOneOfVariant

func (elt *OneOfVariant) IsOneOfVariant() bool

func (*OneOfVariant) IsOptionalType

func (elt *OneOfVariant) IsOptionalType() bool

func (*OneOfVariant) String

func (oov *OneOfVariant) String() string

type OptionalType

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

Identifies an optional type.

func NewOptionalType

func NewOptionalType() *OptionalType

func (*OptionalType) IsArrayElement

func (elt *OptionalType) IsArrayElement() bool

func (*OptionalType) IsFieldName

func (elt *OptionalType) IsFieldName() bool

func (*OptionalType) IsMapKeyType

func (elt *OptionalType) IsMapKeyType() bool

func (*OptionalType) IsMapValueType

func (elt *OptionalType) IsMapValueType() bool

func (*OptionalType) IsOneOfVariant

func (elt *OptionalType) IsOneOfVariant() bool

func (*OptionalType) IsOptionalType

func (elt *OptionalType) IsOptionalType() bool

func (*OptionalType) String

func (*OptionalType) String() string

type PrintVisitor

type PrintVisitor struct {
	DefaultSpecVisitorImpl
}

func (*PrintVisitor) EnterData

func (*PrintVisitor) EnterData(ctx SpecVisitorContext, d *pb.Data) Cont

func (*PrintVisitor) EnterPrimitive

func (*PrintVisitor) EnterPrimitive(ctx SpecVisitorContext, p *pb.Primitive) Cont

type RehashingContextlessSpecVisitor

type RehashingContextlessSpecVisitor struct {
	DefaultContextlessSpecVisitorImpl
}

An abstract contextless visitor for recomputing node hashes while walking back up the tree.

func (*RehashingContextlessSpecVisitor) LeaveMethod

func (*RehashingContextlessSpecVisitor) LeaveMethod(self interface{}, _ SpecVisitorContext, method *api_spec.Method, cont Cont) Cont

func (*RehashingContextlessSpecVisitor) LeaveOneOf

func (*RehashingContextlessSpecVisitor) LeaveOneOf(self interface{}, _ SpecVisitorContext, oneOf *api_spec.OneOf, cont Cont) Cont

type RehashingSpecVisitor

type RehashingSpecVisitor struct {
	DefaultSpecVisitorImpl
}

An abstract visitor for recomputing node hashes while walking back up the tree.

func (*RehashingSpecVisitor) LeaveMethod

func (*RehashingSpecVisitor) LeaveMethod(self interface{}, _ SpecVisitorContext, method *api_spec.Method, cont Cont) Cont

func (*RehashingSpecVisitor) LeaveOneOf

func (*RehashingSpecVisitor) LeaveOneOf(self interface{}, _ SpecVisitorContext, oneOf *api_spec.OneOf, cont Cont) Cont

type SpecPairVisitor

type SpecPairVisitor interface {
	EnterAPISpecs(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.APISpec) Cont
	VisitAPISpecChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.APISpec) Cont
	LeaveAPISpecs(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.APISpec, cont Cont) Cont

	EnterMethods(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Method) Cont
	VisitMethodChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Method) Cont
	LeaveMethods(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Method, cont Cont) Cont

	// A utility function for visiting a set of arguments in a method request or
	// response. This is needed since the arguments are store in maps whose keys
	// do not reliably identify the arguments.
	VisitMethodArgs(self interface{}, ctxt PairContext, vm PairVisitorManager, left, right map[string]*pb.Data) Cont

	EnterMethodMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.MethodMeta) Cont
	VisitMethodMetaChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.MethodMeta) Cont
	LeaveMethodMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.MethodMeta, cont Cont) Cont

	EnterHTTPMethodMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPMethodMeta) Cont
	VisitHTTPMethodMetaChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPMethodMeta) Cont
	LeaveHTTPMethodMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPMethodMeta, cont Cont) Cont

	EnterData(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Data) Cont
	VisitDataChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Data) Cont
	LeaveData(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Data, cont Cont) Cont

	EnterDataMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.DataMeta) Cont
	VisitDataMetaChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.DataMeta) Cont
	LeaveDataMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.DataMeta, cont Cont) Cont

	EnterHTTPMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPMeta) Cont
	VisitHTTPMetaChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPMeta) Cont
	LeaveHTTPMetas(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPMeta, cont Cont) Cont

	EnterHTTPPaths(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPPath) Cont
	VisitHTTPPathChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPPath) Cont
	LeaveHTTPPaths(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPPath, cont Cont) Cont

	EnterHTTPQueries(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPQuery) Cont
	VisitHTTPQueryChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPQuery) Cont
	LeaveHTTPQueries(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPQuery, cont Cont) Cont

	EnterHTTPHeaders(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPHeader) Cont
	VisitHTTPHeaderChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPHeader) Cont
	LeaveHTTPHeaders(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPHeader, cont Cont) Cont

	EnterHTTPCookies(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPCookie) Cont
	VisitHTTPCookieChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPCookie) Cont
	LeaveHTTPCookies(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPCookie, cont Cont) Cont

	EnterHTTPBodies(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPBody) Cont
	VisitHTTPBodyChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPBody) Cont
	LeaveHTTPBodies(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPBody, cont Cont) Cont

	EnterHTTPEmpties(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPEmpty) Cont
	VisitHTTPEmptyChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPEmpty) Cont
	LeaveHTTPEmpties(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPEmpty, cont Cont) Cont

	EnterHTTPAuths(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPAuth) Cont
	VisitHTTPAuthChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPAuth) Cont
	LeaveHTTPAuths(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPAuth, cont Cont) Cont

	EnterHTTPMultiparts(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPMultipart) Cont
	VisitHTTPMultipartChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.HTTPMultipart) Cont
	LeaveHTTPMultiparts(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.HTTPMultipart, cont Cont) Cont

	EnterPrimitives(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Primitive) Cont
	VisitPrimitiveChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Primitive) Cont
	LeavePrimitives(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Primitive, cont Cont) Cont

	EnterStructs(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Struct) Cont
	VisitStructChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Struct) Cont
	LeaveStructs(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Struct, cont Cont) Cont

	EnterLists(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.List) Cont
	VisitListChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.List) Cont
	LeaveLists(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.List, cont Cont) Cont

	EnterOptionals(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Optional) Cont
	VisitOptionalChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.Optional) Cont
	LeaveOptionals(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.Optional, cont Cont) Cont

	EnterOneOfs(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.OneOf) Cont
	VisitOneOfChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right *pb.OneOf) Cont
	LeaveOneOfs(self interface{}, ctxt SpecPairVisitorContext, left, right *pb.OneOf, cont Cont) Cont

	// Visits the children of an unknown node type.
	DefaultVisitChildren(self interface{}, ctxt SpecPairVisitorContext, vm PairVisitorManager, left, right interface{}) Cont

	// Used when the visitor tries to enter two nodes with different types. This
	// cannot return Continue; otherwise, visitChildren will panic.
	EnterDifferentTypes(self interface{}, ctxt SpecPairVisitorContext, left, right interface{}) Cont

	// Used when the visitor tries to leave two nodes with different types.
	LeaveDifferentTypes(self interface{}, ctxt SpecPairVisitorContext, left, right interface{}, cont Cont) Cont
}

A PairVisitorManager that lets you read each message in a pair of APISpecs, starting with the APISpec messages themselves. When the visitor encounters a type difference between the two halves of the pair, EnterDifferentTypes and LeaveDifferentTypes is used to enter and leave the nodes, but the nodes' children are not visited; EnterDifferentTypes must never return Continue.

Go lacks virtual functions, so all functions here take the visitor itself as an argument, and call functions on that instance.

type SpecPairVisitorContext

type SpecPairVisitorContext interface {
	visitors.PairContext

	ExtendLeftContext(leftNode interface{})
	ExtendRightContext(rightNode interface{})

	GetLeftContext() SpecVisitorContext
	GetRightContext() SpecVisitorContext
	SplitContext() (SpecVisitorContext, SpecVisitorContext)

	GetRestPaths() ([]string, []string)
	GetRestOperations() (string, string)

	IsArg() (bool, bool)
	IsResponse() (bool, bool)
	GetValueTypes() (HttpValueType, HttpValueType)
	GetArgPaths() ([]string, []string)
	GetResponsePaths() ([]string, []string)
	GetEndpointPaths() (string, string)
	GetHosts() (string, string)

	// Returns, for each side, the innermost node being visited having the given
	// type, and the nodes' context.
	GetInnermostNode(reflect.Type) (left, right interface{}, ctxt SpecPairVisitorContext)
	// contains filtered or unexported methods
}

Basically a pair of HttpRestSpecVisitorContexts. See that class for more information.

type SpecVisitor

type SpecVisitor interface {
	// Creates a new empty context for visiting an IR root. For visitors that
	// do not care about context, NewDummyContext() is a good implementation.
	// Otherwise, NewPreallocatedVisitorContext() is a good default.
	NewContext() SpecVisitorContext

	EnterAPISpec(self interface{}, ctxt SpecVisitorContext, node *pb.APISpec) Cont
	VisitAPISpecChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.APISpec) Cont
	LeaveAPISpec(self interface{}, ctxt SpecVisitorContext, node *pb.APISpec, cont Cont) Cont

	EnterMethod(self interface{}, ctxt SpecVisitorContext, node *pb.Method) Cont
	VisitMethodChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.Method) Cont
	LeaveMethod(self interface{}, ctxt SpecVisitorContext, node *pb.Method, cont Cont) Cont

	EnterMethodMeta(self interface{}, ctxt SpecVisitorContext, node *pb.MethodMeta) Cont
	VisitMethodMetaChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.MethodMeta) Cont
	LeaveMethodMeta(self interface{}, ctxt SpecVisitorContext, node *pb.MethodMeta, cont Cont) Cont

	EnterHTTPMethodMeta(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPMethodMeta) Cont
	VisitHTTPMethodMetaChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPMethodMeta) Cont
	LeaveHTTPMethodMeta(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPMethodMeta, cont Cont) Cont

	EnterData(self interface{}, ctxt SpecVisitorContext, node *pb.Data) Cont
	VisitDataChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.Data) Cont
	LeaveData(self interface{}, ctxt SpecVisitorContext, node *pb.Data, cont Cont) Cont

	EnterDataMeta(self interface{}, ctxt SpecVisitorContext, node *pb.DataMeta) Cont
	VisitDataMetaChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.DataMeta) Cont
	LeaveDataMeta(self interface{}, ctxt SpecVisitorContext, node *pb.DataMeta, cont Cont) Cont

	EnterHTTPMeta(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPMeta) Cont
	VisitHTTPMetaChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPMeta) Cont
	LeaveHTTPMeta(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPMeta, cont Cont) Cont

	EnterHTTPPath(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPPath) Cont
	VisitHTTPPathChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPPath) Cont
	LeaveHTTPPath(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPPath, cont Cont) Cont

	EnterHTTPQuery(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPQuery) Cont
	VisitHTTPQueryChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPQuery) Cont
	LeaveHTTPQuery(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPQuery, cont Cont) Cont

	EnterHTTPHeader(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPHeader) Cont
	VisitHTTPHeaderChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPHeader) Cont
	LeaveHTTPHeader(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPHeader, cont Cont) Cont

	EnterHTTPCookie(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPCookie) Cont
	VisitHTTPCookieChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPCookie) Cont
	LeaveHTTPCookie(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPCookie, cont Cont) Cont

	EnterHTTPBody(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPBody) Cont
	VisitHTTPBodyChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPBody) Cont
	LeaveHTTPBody(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPBody, cont Cont) Cont

	EnterHTTPEmpty(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPEmpty) Cont
	VisitHTTPEmptyChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPEmpty) Cont
	LeaveHTTPEmpty(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPEmpty, cont Cont) Cont

	EnterHTTPAuth(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPAuth) Cont
	VisitHTTPAuthChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPAuth) Cont
	LeaveHTTPAuth(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPAuth, cont Cont) Cont

	EnterHTTPMultipart(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPMultipart) Cont
	VisitHTTPMultipartChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.HTTPMultipart) Cont
	LeaveHTTPMultipart(self interface{}, ctxt SpecVisitorContext, node *pb.HTTPMultipart, cont Cont) Cont

	EnterPrimitive(self interface{}, ctxt SpecVisitorContext, node *pb.Primitive) Cont
	VisitPrimitiveChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.Primitive) Cont
	LeavePrimitive(self interface{}, ctxt SpecVisitorContext, node *pb.Primitive, cont Cont) Cont

	EnterStruct(self interface{}, ctxt SpecVisitorContext, node *pb.Struct) Cont
	VisitStructChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.Struct) Cont
	LeaveStruct(self interface{}, ctxt SpecVisitorContext, node *pb.Struct, cont Cont) Cont

	EnterList(self interface{}, ctxt SpecVisitorContext, node *pb.List) Cont
	VisitListChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.List) Cont
	LeaveList(self interface{}, ctxt SpecVisitorContext, node *pb.List, cont Cont) Cont

	EnterOptional(self interface{}, ctxt SpecVisitorContext, node *pb.Optional) Cont
	VisitOptionalChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.Optional) Cont
	LeaveOptional(self interface{}, ctxt SpecVisitorContext, node *pb.Optional, cont Cont) Cont

	EnterOneOf(self interface{}, ctxt SpecVisitorContext, node *pb.OneOf) Cont
	VisitOneOfChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node *pb.OneOf) Cont
	LeaveOneOf(self interface{}, ctxt SpecVisitorContext, node *pb.OneOf, cont Cont) Cont

	// Visits the children of an unknown type.
	DefaultVisitChildren(self interface{}, ctxt SpecVisitorContext, vm VisitorManager, node interface{}) Cont
}

VisitorManager that lets you read each message in an APISpec, starting with the APISpec message itself.

type SpecVisitorContext

type SpecVisitorContext interface {
	visitors.Context

	// Identifies the REST field being visited when combined with IsArg,
	// IsResponse, and GetValueType. For fields outside of bodies and
	// authorization headers, the first component of the path is a FieldName
	// identifying the path argument, query variable, header, or cookie in which
	// the field is located.
	GetFieldPath() []FieldPathElement

	// Gets the REST path, which is similar to the AST path but using names
	// from DataMeta and MethodMeta objects where appropriate, as well as
	// hiding names of container data structures.
	//
	// For example, the AST path to a path parameter might be:
	//
	//   Methods 0 Args arg-headers-0 Value Primitive
	//
	// These are the names of the fields in the AST.  In contrast, the REST
	// path might be:
	//
	//   localhost:9000 GET /api/0/issues/{issue_id}/events/ Header Authorization
	//
	GetRestPath() []string

	// Returns the REST operation name of the method being traversed, if the
	// visitor is visiting a method or its descendent nodes.
	GetRestOperation() string

	// Returns true if the message is a descendent of Method.Args.
	IsArg() bool

	// Returns true if the message is a descendent of Method.Responses.
	IsResponse() bool

	// Returns true if the message is a descendant of (or is itself) a Data
	// instance representing an optional value.
	IsOptional() bool

	GetValueType() HttpValueType

	GetHttpAuthType() *pb.HTTPAuth_HTTPAuthType

	// Like GetRestPath, except only including the portion about the argument
	// value.
	GetArgPath() []string

	// Like GetRestPath, except only including the portion about the argument
	// value.
	GetResponsePath() []string

	// Returns the endpoint path, e.g. the "/v1/users" part of
	// "localhost GET /v1/users".
	GetEndpointPath() string

	// This is nil if the message is not a descendant of Method.Responses.
	GetResponseCode() *string

	// This is nil if the message is not part of a body.
	GetContentType() *string

	// Returns the host.
	GetHost() string

	// Returns the innermost node being visited having the given type, and that
	// node's context.
	GetInnermostNode(reflect.Type) (interface{}, SpecVisitorContext)
	// contains filtered or unexported methods
}

func NewPreallocatedVisitorContext

func NewPreallocatedVisitorContext() SpecVisitorContext

Jump to

Keyboard shortcuts

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