add frame protobuf

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-03-07 01:32:02 +03:00
parent 2a8745178f
commit fb4d0dda79
3 changed files with 298 additions and 1 deletions

View File

@ -6,4 +6,7 @@ package main
//go:generate protoc -I. -I./api --go_out=paths=source_relative:. ./api/field_behavior.proto
//go:generate protoc -I. -I./api --go_out=paths=source_relative:. ./api/httpbody.proto
//go:generate protoc -I. -I./openapiv2 --go_out=paths=source_relative:. ./openapiv2/annotations.proto
//go:generate protoc -I. -I./openapiv2 --go_out=paths=source_relative:. ./openapiv2/openapiv2.proto
///go:generate protoc -I. -I./openapiv2 --go_out=paths=source_relative:. ./openapiv2/openapiv2.proto
//go:generate protoc -I. -I./openapiv2 --go_out=paths=source_relative:. ./openapiv2/gopenapiv2.proto
//go:generate protoc -I. -I./openapiv3 --go_out=paths=source_relative:. ./openapiv3/gopenapiv3.proto
//go:generate protoc -I. -I./proto --go_out=paths=source_relative:. ./proto/frame.proto

224
proto/frame.pb.go Normal file
View File

@ -0,0 +1,224 @@
// Copyright 2021 Unistack LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.6.1
// source: proto/frame.proto
package micro
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// Message that represents an arbitrary byes. It should only be used for
// payload formats that can't be represented as any other messages like raw binary.
//
//
// This message can be used both in streaming and non-streaming API methods in
// the request as well as the response.
//
// It can be used as a top-level request field, which is convenient if one
// wants to extract parameters from either the URL or HTTP template into the
// request fields and also want access to the raw HTTP body.
//
// Example:
//
// message GetResourceRequest {
// // A unique request id.
// string request_id = 1;
//
// // The raw HTTP body is bound to this field.
// micro.proto.Frame http_body = 2;
// }
//
// service ResourceService {
// rpc GetResource(GetResourceRequest) returns (micro.proto.Frame);
// rpc UpdateResource(micro.proto.Frame) returns
// (google.protobuf.Empty);
// }
//
// Example with streaming methods:
//
// service CaldavService {
// rpc GetCalendar(stream micro.proto.Frame)
// returns (stream micro.proto.Frame);
// rpc UpdateCalendar(stream micro.proto.Frame)
// returns (stream micro.proto.Frame);
// }
//
// Use of this type only changes how the request and response bodies are
// handled, all other features will continue to work unchanged.
type Frame struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Application specific response metadata. Must be set in the first response
// for streaming APIs.
Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// The HTTP request/response body as raw binary.
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}
func (x *Frame) Reset() {
*x = Frame{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_frame_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Frame) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Frame) ProtoMessage() {}
func (x *Frame) ProtoReflect() protoreflect.Message {
mi := &file_proto_frame_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Frame.ProtoReflect.Descriptor instead.
func (*Frame) Descriptor() ([]byte, []int) {
return file_proto_frame_proto_rawDescGZIP(), []int{0}
}
func (x *Frame) GetHeaders() map[string]string {
if x != nil {
return x.Headers
}
return nil
}
func (x *Frame) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
var File_proto_frame_proto protoreflect.FileDescriptor
var file_proto_frame_proto_rawDesc = []byte{
0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x92, 0x01, 0x0a, 0x05, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x69,
0x63, 0x72, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x2e,
0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x58, 0x0a, 0x0b, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x42, 0x0a, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75,
0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69, 0x63, 0x72,
0x6f, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x3b, 0x6d, 0x69,
0x63, 0x72, 0x6f, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x06, 0x4d, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_proto_frame_proto_rawDescOnce sync.Once
file_proto_frame_proto_rawDescData = file_proto_frame_proto_rawDesc
)
func file_proto_frame_proto_rawDescGZIP() []byte {
file_proto_frame_proto_rawDescOnce.Do(func() {
file_proto_frame_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_frame_proto_rawDescData)
})
return file_proto_frame_proto_rawDescData
}
var file_proto_frame_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_proto_frame_proto_goTypes = []interface{}{
(*Frame)(nil), // 0: micro.proto.Frame
nil, // 1: micro.proto.Frame.HeadersEntry
}
var file_proto_frame_proto_depIdxs = []int32{
1, // 0: micro.proto.Frame.headers:type_name -> micro.proto.Frame.HeadersEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_proto_frame_proto_init() }
func file_proto_frame_proto_init() {
if File_proto_frame_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_proto_frame_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Frame); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_frame_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_proto_frame_proto_goTypes,
DependencyIndexes: file_proto_frame_proto_depIdxs,
MessageInfos: file_proto_frame_proto_msgTypes,
}.Build()
File_proto_frame_proto = out.File
file_proto_frame_proto_rawDesc = nil
file_proto_frame_proto_goTypes = nil
file_proto_frame_proto_depIdxs = nil
}

70
proto/frame.proto Normal file
View File

@ -0,0 +1,70 @@
// Copyright 2021 Unistack LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package micro.proto;
option cc_enable_arenas = true;
option go_package = "github.com/unistack-org/micro-proto/micro;micro";
option java_multiple_files = true;
option java_outer_classname = "MicroProto";
option java_package = "micro.proto";
option objc_class_prefix = "MPROTO";
// Message that represents an arbitrary byes. It should only be used for
// payload formats that can't be represented as any other messages like raw binary.
//
//
// This message can be used both in streaming and non-streaming API methods in
// the request as well as the response.
//
// It can be used as a top-level request field, which is convenient if one
// wants to extract parameters from either the URL or HTTP template into the
// request fields and also want access to the raw HTTP body.
//
// Example:
//
// message GetResourceRequest {
// // A unique request id.
// string request_id = 1;
//
// // The raw HTTP body is bound to this field.
// micro.proto.Frame http_body = 2;
// }
//
// service ResourceService {
// rpc GetResource(GetResourceRequest) returns (micro.proto.Frame);
// rpc UpdateResource(micro.proto.Frame) returns
// (google.protobuf.Empty);
// }
//
// Example with streaming methods:
//
// service CaldavService {
// rpc GetCalendar(stream micro.proto.Frame)
// returns (stream micro.proto.Frame);
// rpc UpdateCalendar(stream micro.proto.Frame)
// returns (stream micro.proto.Frame);
// }
//
// Use of this type only changes how the request and response bodies are
// handled, all other features will continue to work unchanged.
message Frame {
// Application specific response metadata. Must be set in the first response
// for streaming APIs.
map<string,string> headers = 1;
// The HTTP request/response body as raw binary.
bytes data = 2;
}