surface_v1

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

README

API Code Surface

This directory contains a Protocol Buffer-language model suitable for generating support code for calling and implementing an API.

It can be generated from other formats read by gnostic and passed to code generator plugins to assist them by providing a preprocessed API description that is easier to generate.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldKind_name = map[int32]string{
	0: "SCALAR",
	1: "MAP",
	2: "ARRAY",
	3: "REFERENCE",
	4: "ANY",
}
View Source
var FieldKind_value = map[string]int32{
	"SCALAR":    0,
	"MAP":       1,
	"ARRAY":     2,
	"REFERENCE": 3,
	"ANY":       4,
}
View Source
var Position_name = map[int32]string{
	0: "BODY",
	1: "HEADER",
	2: "FORMDATA",
	3: "QUERY",
	4: "PATH",
}
View Source
var Position_value = map[string]int32{
	"BODY":     0,
	"HEADER":   1,
	"FORMDATA": 2,
	"QUERY":    3,
	"PATH":     4,
}
View Source
var TypeKind_name = map[int32]string{
	0: "STRUCT",
	1: "OBJECT",
}
View Source
var TypeKind_value = map[string]int32{
	"STRUCT": 0,
	"OBJECT": 1,
}

Functions

This section is empty.

Types

type Field

type Field struct {
	Name                 string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type                 string    `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Kind                 FieldKind `protobuf:"varint,3,opt,name=kind,proto3,enum=surface.v1.FieldKind" json:"kind,omitempty"`
	Format               string    `protobuf:"bytes,4,opt,name=format,proto3" json:"format,omitempty"`
	Position             Position  `protobuf:"varint,5,opt,name=position,proto3,enum=surface.v1.Position" json:"position,omitempty"`
	NativeType           string    `protobuf:"bytes,6,opt,name=native_type,json=nativeType,proto3" json:"native_type,omitempty"`
	FieldName            string    `protobuf:"bytes,7,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"`
	ParameterName        string    `protobuf:"bytes,8,opt,name=parameter_name,json=parameterName,proto3" json:"parameter_name,omitempty"`
	Serialize            bool      `protobuf:"varint,9,opt,name=serialize,proto3" json:"serialize,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Field is a field in a definition and can be associated with a position in a request structure.

func (*Field) Descriptor

func (*Field) Descriptor() ([]byte, []int)

func (*Field) GetFieldName

func (m *Field) GetFieldName() string

func (*Field) GetFormat

func (m *Field) GetFormat() string

func (*Field) GetKind

func (m *Field) GetKind() FieldKind

func (*Field) GetName

func (m *Field) GetName() string

func (*Field) GetNativeType

func (m *Field) GetNativeType() string

func (*Field) GetParameterName

func (m *Field) GetParameterName() string

func (*Field) GetPosition

func (m *Field) GetPosition() Position

func (*Field) GetSerialize

func (m *Field) GetSerialize() bool

func (*Field) GetType

func (m *Field) GetType() string

func (*Field) ProtoMessage

func (*Field) ProtoMessage()

func (*Field) Reset

func (m *Field) Reset()

func (*Field) ServiceType

func (f *Field) ServiceType(m *Model) *Type

ServiceType returns the Type associated with a field.

func (*Field) String

func (m *Field) String() string

func (*Field) XXX_DiscardUnknown added in v0.4.0

func (m *Field) XXX_DiscardUnknown()

func (*Field) XXX_Marshal added in v0.4.0

func (m *Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Field) XXX_Merge added in v0.4.0

func (m *Field) XXX_Merge(src proto.Message)

func (*Field) XXX_Size added in v0.4.0

func (m *Field) XXX_Size() int

func (*Field) XXX_Unmarshal added in v0.4.0

func (m *Field) XXX_Unmarshal(b []byte) error

type FieldInfo added in v0.4.0

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

The structure to transport information during the recursive calls inside model_openapiv2.go and model_openapiv3.go

type FieldKind

type FieldKind int32
const (
	FieldKind_SCALAR    FieldKind = 0
	FieldKind_MAP       FieldKind = 1
	FieldKind_ARRAY     FieldKind = 2
	FieldKind_REFERENCE FieldKind = 3
	FieldKind_ANY       FieldKind = 4
)

func (FieldKind) EnumDescriptor

func (FieldKind) EnumDescriptor() ([]byte, []int)

func (FieldKind) String

func (x FieldKind) String() string

type Method

type Method struct {
	Operation            string   `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"`
	Path                 string   `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Method               string   `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	Description          string   `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
	Name                 string   `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
	HandlerName          string   `protobuf:"bytes,6,opt,name=handler_name,json=handlerName,proto3" json:"handler_name,omitempty"`
	ProcessorName        string   `protobuf:"bytes,7,opt,name=processor_name,json=processorName,proto3" json:"processor_name,omitempty"`
	ClientName           string   `protobuf:"bytes,8,opt,name=client_name,json=clientName,proto3" json:"client_name,omitempty"`
	ParametersTypeName   string   `protobuf:"bytes,9,opt,name=parameters_type_name,json=parametersTypeName,proto3" json:"parameters_type_name,omitempty"`
	ResponsesTypeName    string   `protobuf:"bytes,10,opt,name=responses_type_name,json=responsesTypeName,proto3" json:"responses_type_name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Method is an operation of an API and typically has associated client and server code.

func (*Method) Descriptor

func (*Method) Descriptor() ([]byte, []int)

func (*Method) GetClientName

func (m *Method) GetClientName() string

func (*Method) GetDescription

func (m *Method) GetDescription() string

func (*Method) GetHandlerName

func (m *Method) GetHandlerName() string

func (*Method) GetMethod

func (m *Method) GetMethod() string

func (*Method) GetName

func (m *Method) GetName() string

func (*Method) GetOperation

func (m *Method) GetOperation() string

func (*Method) GetParametersTypeName

func (m *Method) GetParametersTypeName() string

func (*Method) GetPath

func (m *Method) GetPath() string

func (*Method) GetProcessorName

func (m *Method) GetProcessorName() string

func (*Method) GetResponsesTypeName

func (m *Method) GetResponsesTypeName() string

func (*Method) ProtoMessage

func (*Method) ProtoMessage()

func (*Method) Reset

func (m *Method) Reset()

func (*Method) String

func (m *Method) String() string

func (*Method) XXX_DiscardUnknown added in v0.4.0

func (m *Method) XXX_DiscardUnknown()

func (*Method) XXX_Marshal added in v0.4.0

func (m *Method) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Method) XXX_Merge added in v0.4.0

func (m *Method) XXX_Merge(src proto.Message)

func (*Method) XXX_Size added in v0.4.0

func (m *Method) XXX_Size() int

func (*Method) XXX_Unmarshal added in v0.4.0

func (m *Method) XXX_Unmarshal(b []byte) error

type Model

type Model struct {
	Name                 string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Types                []*Type   `protobuf:"bytes,2,rep,name=types,proto3" json:"types,omitempty"`
	Methods              []*Method `protobuf:"bytes,3,rep,name=methods,proto3" json:"methods,omitempty"`
	SymbolicReferences   []string  `protobuf:"bytes,4,rep,name=symbolic_references,json=symbolicReferences,proto3" json:"symbolic_references,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Model represents an API for code generation.

func NewModelFromOpenAPI2

func NewModelFromOpenAPI2(document *openapiv2.Document, sourceName string) (*Model, error)

NewModelFromOpenAPI2 builds a model of an API service for use in code generation.

func NewModelFromOpenAPI3

func NewModelFromOpenAPI3(document *openapiv3.Document, sourceName string) (*Model, error)

NewModelFromOpenAPIv3 builds a model of an API service for use in code generation.

func (*Model) Descriptor

func (*Model) Descriptor() ([]byte, []int)

func (*Model) GetMethods

func (m *Model) GetMethods() []*Method

func (*Model) GetName

func (m *Model) GetName() string

func (*Model) GetSymbolicReferences added in v0.4.0

func (m *Model) GetSymbolicReferences() []string

func (*Model) GetTypes

func (m *Model) GetTypes() []*Type

func (*Model) ProtoMessage

func (*Model) ProtoMessage()

func (*Model) Reset

func (m *Model) Reset()

func (*Model) String

func (m *Model) String() string

func (*Model) TypeWithTypeName

func (m *Model) TypeWithTypeName(name string) *Type

func (*Model) XXX_DiscardUnknown added in v0.4.0

func (m *Model) XXX_DiscardUnknown()

func (*Model) XXX_Marshal added in v0.4.0

func (m *Model) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Model) XXX_Merge added in v0.4.0

func (m *Model) XXX_Merge(src proto.Message)

func (*Model) XXX_Size added in v0.4.0

func (m *Model) XXX_Size() int

func (*Model) XXX_Unmarshal added in v0.4.0

func (m *Model) XXX_Unmarshal(b []byte) error

type OpenAPI2Builder

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

type OpenAPI3Builder

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

type Position

type Position int32
const (
	Position_BODY     Position = 0
	Position_HEADER   Position = 1
	Position_FORMDATA Position = 2
	Position_QUERY    Position = 3
	Position_PATH     Position = 4
)

func (Position) EnumDescriptor

func (Position) EnumDescriptor() ([]byte, []int)

func (Position) String

func (x Position) String() string

type Type

type Type struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Kind                 TypeKind `protobuf:"varint,2,opt,name=kind,proto3,enum=surface.v1.TypeKind" json:"kind,omitempty"`
	Description          string   `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	ContentType          string   `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	Fields               []*Field `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty"`
	TypeName             string   `protobuf:"bytes,6,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Type typically corresponds to a definition, parameter, or response in an API and is represented by a type in generated code.

func (*Type) Descriptor

func (*Type) Descriptor() ([]byte, []int)

func (*Type) FieldWithName

func (s *Type) FieldWithName(name string) *Field

func (*Type) FieldWithPosition

func (s *Type) FieldWithPosition(position Position) *Field

func (*Type) GetContentType

func (m *Type) GetContentType() string

func (*Type) GetDescription

func (m *Type) GetDescription() string

func (*Type) GetFields

func (m *Type) GetFields() []*Field

func (*Type) GetKind

func (m *Type) GetKind() TypeKind

func (*Type) GetName

func (m *Type) GetName() string

func (*Type) GetTypeName

func (m *Type) GetTypeName() string

func (*Type) HasFieldWithName

func (s *Type) HasFieldWithName(name string) bool

func (*Type) HasFieldWithPosition

func (s *Type) HasFieldWithPosition(position Position) bool

func (*Type) ProtoMessage

func (*Type) ProtoMessage()

func (*Type) Reset

func (m *Type) Reset()

func (*Type) String

func (m *Type) String() string

func (*Type) XXX_DiscardUnknown added in v0.4.0

func (m *Type) XXX_DiscardUnknown()

func (*Type) XXX_Marshal added in v0.4.0

func (m *Type) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Type) XXX_Merge added in v0.4.0

func (m *Type) XXX_Merge(src proto.Message)

func (*Type) XXX_Size added in v0.4.0

func (m *Type) XXX_Size() int

func (*Type) XXX_Unmarshal added in v0.4.0

func (m *Type) XXX_Unmarshal(b []byte) error

type TypeKind

type TypeKind int32
const (
	TypeKind_STRUCT TypeKind = 0
	TypeKind_OBJECT TypeKind = 1
)

func (TypeKind) EnumDescriptor

func (TypeKind) EnumDescriptor() ([]byte, []int)

func (TypeKind) String

func (x TypeKind) String() string

Jump to

Keyboard shortcuts

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