Documentation ¶
Index ¶
- Variables
- type Field
- func (*Field) Descriptor() ([]byte, []int)deprecated
- func (x *Field) GetEnumValues() []string
- func (x *Field) GetFieldName() string
- func (x *Field) GetFormat() string
- func (x *Field) GetKind() FieldKind
- func (x *Field) GetName() string
- func (x *Field) GetNativeType() string
- func (x *Field) GetParameterName() string
- func (x *Field) GetPosition() Position
- func (x *Field) GetSerialize() bool
- func (x *Field) GetType() string
- func (*Field) ProtoMessage()
- func (x *Field) ProtoReflect() protoreflect.Message
- func (x *Field) Reset()
- func (f *Field) ServiceType(m *Model) *Type
- func (x *Field) String() string
- type FieldInfo
- type FieldKind
- type Method
- func (*Method) Descriptor() ([]byte, []int)deprecated
- func (x *Method) GetClientName() string
- func (x *Method) GetDescription() string
- func (x *Method) GetHandlerName() string
- func (x *Method) GetMethod() string
- func (x *Method) GetName() string
- func (x *Method) GetOperation() string
- func (x *Method) GetParametersTypeName() string
- func (x *Method) GetPath() string
- func (x *Method) GetProcessorName() string
- func (x *Method) GetResponsesTypeName() string
- func (*Method) ProtoMessage()
- func (x *Method) ProtoReflect() protoreflect.Message
- func (x *Method) Reset()
- func (x *Method) String() string
- type Model
- func (*Model) Descriptor() ([]byte, []int)deprecated
- func (x *Model) GetMethods() []*Method
- func (x *Model) GetName() string
- func (x *Model) GetSymbolicReferences() []string
- func (x *Model) GetTypes() []*Type
- func (*Model) ProtoMessage()
- func (x *Model) ProtoReflect() protoreflect.Message
- func (x *Model) Reset()
- func (x *Model) String() string
- func (m *Model) TypeWithTypeName(name string) *Type
- type OpenAPI2Builder
- type OpenAPI3Builder
- type Position
- type Type
- func (*Type) Descriptor() ([]byte, []int)deprecated
- func (s *Type) FieldWithName(name string) *Field
- func (s *Type) FieldWithPosition(position Position) *Field
- func (x *Type) GetContentType() string
- func (x *Type) GetDescription() string
- func (x *Type) GetFields() []*Field
- func (x *Type) GetKind() TypeKind
- func (x *Type) GetName() string
- func (x *Type) GetTypeName() string
- func (s *Type) HasFieldWithName(name string) bool
- func (s *Type) HasFieldWithPosition(position Position) bool
- func (*Type) ProtoMessage()
- func (x *Type) ProtoReflect() protoreflect.Message
- func (x *Type) Reset()
- func (x *Type) String() string
- type TypeKind
Constants ¶
This section is empty.
Variables ¶
var ( FieldKind_name = map[int32]string{ 0: "SCALAR", 1: "MAP", 2: "ARRAY", 3: "REFERENCE", 4: "ANY", } FieldKind_value = map[string]int32{ "SCALAR": 0, "MAP": 1, "ARRAY": 2, "REFERENCE": 3, "ANY": 4, } )
Enum value maps for FieldKind.
var ( TypeKind_name = map[int32]string{ 0: "STRUCT", 1: "OBJECT", } TypeKind_value = map[string]int32{ "STRUCT": 0, "OBJECT": 1, } )
Enum value maps for TypeKind.
var ( Position_name = map[int32]string{ 0: "BODY", 1: "HEADER", 2: "FORMDATA", 3: "QUERY", 4: "PATH", } Position_value = map[string]int32{ "BODY": 0, "HEADER": 1, "FORMDATA": 2, "QUERY": 3, "PATH": 4, } )
Enum value maps for Position.
var File_surface_surface_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // the name as specified in the API description Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // the specified content type of the field Kind FieldKind `protobuf:"varint,3,opt,name=kind,proto3,enum=surface.v1.FieldKind" json:"kind,omitempty"` // what kind of thing is this field? scalar, reference, // array, map of strings to the specified type Format string `protobuf:"bytes,4,opt,name=format,proto3" json:"format,omitempty"` // the specified format of the field Position Position `protobuf:"varint,5,opt,name=position,proto3,enum=surface.v1.Position" json:"position,omitempty"` // "body", "header", "formdata", "query", or "path" NativeType string `protobuf:"bytes,6,opt,name=native_type,json=nativeType,proto3" json:"native_type,omitempty"` // the programming-language native type of the field FieldName string `protobuf:"bytes,7,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"` // the name to use for a data structure field ParameterName string `protobuf:"bytes,8,opt,name=parameter_name,json=parameterName,proto3" json:"parameter_name,omitempty"` // the name to use for a function parameter Serialize bool `protobuf:"varint,9,opt,name=serialize,proto3" json:"serialize,omitempty"` // true if this field should be serialized (to JSON, etc) EnumValues []string `protobuf:"bytes,10,rep,name=enum_values,json=enumValues,proto3" json:"enum_values,omitempty"` // enum values as specified in the API description // contains filtered or unexported fields }
Field is a field in a definition and can be associated with a position in a request structure.
func (*Field) Descriptor
deprecated
func (*Field) GetEnumValues ¶ added in v0.7.1
func (*Field) GetFieldName ¶
func (*Field) GetNativeType ¶
func (*Field) GetParameterName ¶
func (*Field) GetPosition ¶
func (*Field) GetSerialize ¶
func (*Field) ProtoMessage ¶
func (*Field) ProtoMessage()
func (*Field) ProtoReflect ¶ added in v0.7.1
func (x *Field) ProtoReflect() protoreflect.Message
func (*Field) ServiceType ¶
ServiceType returns the Type associated with a field.
type FieldInfo ¶ added in v0.7.1
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
func (FieldKind) Descriptor ¶ added in v0.7.1
func (FieldKind) Descriptor() protoreflect.EnumDescriptor
func (FieldKind) EnumDescriptor
deprecated
func (FieldKind) Number ¶ added in v0.7.1
func (x FieldKind) Number() protoreflect.EnumNumber
func (FieldKind) Type ¶ added in v0.7.1
func (FieldKind) Type() protoreflect.EnumType
type Method ¶
type Method struct { Operation string `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` // Operation ID Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` // HTTP path Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` // HTTP method name Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // description of method Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` // Operation name, possibly generated from method and path HandlerName string `protobuf:"bytes,6,opt,name=handler_name,json=handlerName,proto3" json:"handler_name,omitempty"` // name of the generated handler ProcessorName string `protobuf:"bytes,7,opt,name=processor_name,json=processorName,proto3" json:"processor_name,omitempty"` // name of the processing function in the service interface ClientName string `protobuf:"bytes,8,opt,name=client_name,json=clientName,proto3" json:"client_name,omitempty"` // name of client ParametersTypeName string `protobuf:"bytes,9,opt,name=parameters_type_name,json=parametersTypeName,proto3" json:"parameters_type_name,omitempty"` // parameters (input), with fields corresponding to input parameters ResponsesTypeName string `protobuf:"bytes,10,opt,name=responses_type_name,json=responsesTypeName,proto3" json:"responses_type_name,omitempty"` // responses (output), with fields // contains filtered or unexported fields }
Method is an operation of an API and typically has associated client and server code.
func (*Method) Descriptor
deprecated
func (*Method) GetClientName ¶
func (*Method) GetDescription ¶
func (*Method) GetHandlerName ¶
func (*Method) GetOperation ¶
func (*Method) GetParametersTypeName ¶
func (*Method) GetProcessorName ¶
func (*Method) GetResponsesTypeName ¶
func (*Method) ProtoMessage ¶
func (*Method) ProtoMessage()
func (*Method) ProtoReflect ¶ added in v0.7.1
func (x *Method) ProtoReflect() protoreflect.Message
type Model ¶
type Model struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // a free-form title for the API Types []*Type `protobuf:"bytes,2,rep,name=types,proto3" json:"types,omitempty"` // the types used by the API Methods []*Method `protobuf:"bytes,3,rep,name=methods,proto3" json:"methods,omitempty"` // the methods (functions) of the API SymbolicReferences []string `protobuf:"bytes,4,rep,name=symbolic_references,json=symbolicReferences,proto3" json:"symbolic_references,omitempty"` // references to other OpenAPI files. Currently only supported for // contains filtered or unexported fields }
Model represents an API for code generation.
func NewModelFromOpenAPI2 ¶
NewModelFromOpenAPI2 builds a model of an API service for use in code generation.
func NewModelFromOpenAPI3 ¶
NewModelFromOpenAPIv3 builds a model of an API service for use in code generation.
func (*Model) Descriptor
deprecated
func (*Model) GetMethods ¶
func (*Model) GetSymbolicReferences ¶ added in v0.7.1
func (*Model) ProtoMessage ¶
func (*Model) ProtoMessage()
func (*Model) ProtoReflect ¶ added in v0.7.1
func (x *Model) ProtoReflect() protoreflect.Message
func (*Model) TypeWithTypeName ¶
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
func (Position) Descriptor ¶ added in v0.7.1
func (Position) Descriptor() protoreflect.EnumDescriptor
func (Position) EnumDescriptor
deprecated
func (Position) Number ¶ added in v0.7.1
func (x Position) Number() protoreflect.EnumNumber
func (Position) Type ¶ added in v0.7.1
func (Position) Type() protoreflect.EnumType
type Type ¶
type Type struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // the name to use for the type Kind TypeKind `protobuf:"varint,2,opt,name=kind,proto3,enum=surface.v1.TypeKind" json:"kind,omitempty"` // a meta-description of the type (struct, map, etc) Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // a comment describing the type ContentType string `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` // if the type is a map, this is its content type Fields []*Field `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty"` // the fields of the type TypeName string `protobuf:"bytes,6,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` // language-specific type name // contains filtered or unexported fields }
Type typically corresponds to a definition, parameter, or response in an API and is represented by a type in generated code.
func (*Type) Descriptor
deprecated
func (*Type) FieldWithName ¶
func (*Type) FieldWithPosition ¶
func (*Type) GetContentType ¶
func (*Type) GetDescription ¶
func (*Type) GetTypeName ¶
func (*Type) HasFieldWithName ¶
func (*Type) HasFieldWithPosition ¶
func (*Type) ProtoMessage ¶
func (*Type) ProtoMessage()
func (*Type) ProtoReflect ¶ added in v0.7.1
func (x *Type) ProtoReflect() protoreflect.Message
type TypeKind ¶
type TypeKind int32
func (TypeKind) Descriptor ¶ added in v0.7.1
func (TypeKind) Descriptor() protoreflect.EnumDescriptor
func (TypeKind) EnumDescriptor
deprecated
func (TypeKind) Number ¶ added in v0.7.1
func (x TypeKind) Number() protoreflect.EnumNumber
func (TypeKind) Type ¶ added in v0.7.1
func (TypeKind) Type() protoreflect.EnumType