surface_v1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2018 License: Apache-2.0 Imports: 9 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

Overview

Package surface_v1 is a generated protocol buffer package.

It is generated from these files:

surface.proto

It has these top-level messages:

Field
Type
Method
Model

Index

Constants

This section is empty.

Variables

View Source
var FieldKind_name = map[int32]string{
	0: "SCALAR",
	1: "MAP",
	2: "ARRAY",
	3: "REFERENCE",
}
View Source
var FieldKind_value = map[string]int32{
	"SCALAR":    0,
	"MAP":       1,
	"ARRAY":     2,
	"REFERENCE": 3,
}
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" json:"name,omitempty"`
	Type          string    `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"`
	Kind          FieldKind `protobuf:"varint,3,opt,name=kind,enum=surface.v1.FieldKind" json:"kind,omitempty"`
	Format        string    `protobuf:"bytes,4,opt,name=format" json:"format,omitempty"`
	Position      Position  `protobuf:"varint,5,opt,name=position,enum=surface.v1.Position" json:"position,omitempty"`
	NativeType    string    `protobuf:"bytes,6,opt,name=nativeType" json:"nativeType,omitempty"`
	FieldName     string    `protobuf:"bytes,7,opt,name=fieldName" json:"fieldName,omitempty"`
	ParameterName string    `protobuf:"bytes,8,opt,name=parameterName" json:"parameterName,omitempty"`
	Serialize     bool      `protobuf:"varint,9,opt,name=serialize" json:"serialize,omitempty"`
}

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

type FieldKind

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

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" json:"operation,omitempty"`
	Path               string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"`
	Method             string `protobuf:"bytes,3,opt,name=method" json:"method,omitempty"`
	Description        string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"`
	Name               string `protobuf:"bytes,5,opt,name=name" json:"name,omitempty"`
	HandlerName        string `protobuf:"bytes,6,opt,name=handlerName" json:"handlerName,omitempty"`
	ProcessorName      string `protobuf:"bytes,7,opt,name=processorName" json:"processorName,omitempty"`
	ClientName         string `protobuf:"bytes,8,opt,name=clientName" json:"clientName,omitempty"`
	ParametersTypeName string `protobuf:"bytes,9,opt,name=parametersTypeName" json:"parametersTypeName,omitempty"`
	ResponsesTypeName  string `protobuf:"bytes,10,opt,name=responsesTypeName" json:"responsesTypeName,omitempty"`
}

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

type Model

type Model struct {
	Name    string    `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Types   []*Type   `protobuf:"bytes,2,rep,name=types" json:"types,omitempty"`
	Methods []*Method `protobuf:"bytes,3,rep,name=methods" json:"methods,omitempty"`
}

Model represents an API for code generation.

func NewModelFromOpenAPI2

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

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

func NewModelFromOpenAPI3

func NewModelFromOpenAPI3(document *openapiv3.Document) (*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) 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

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" json:"name,omitempty"`
	Kind        TypeKind `protobuf:"varint,2,opt,name=kind,enum=surface.v1.TypeKind" json:"kind,omitempty"`
	Description string   `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
	ContentType string   `protobuf:"bytes,4,opt,name=contentType" json:"contentType,omitempty"`
	Fields      []*Field `protobuf:"bytes,5,rep,name=fields" json:"fields,omitempty"`
	TypeName    string   `protobuf:"bytes,6,opt,name=typeName" json:"typeName,omitempty"`
}

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

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