From 02aa11ff1627c57ea1f9e64215555cd71d46ceb6 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 8 May 2021 00:04:52 +0300 Subject: [PATCH] add tag support Signed-off-by: Vasiliy Tolstov --- api/annotations.pb.go | 106 ++++++++++---- api/annotations.proto | 11 ++ api/field_behavior.pb.go | 19 +-- api/http.pb.go | 9 +- api/httpbody.pb.go | 19 +-- api/micro.pb.go | 275 ++++++++++++++++++++++++++++++++++++ api/micro.proto | 46 ++++++ generate.go | 2 + openapiv2/annotations.pb.go | 51 +++---- openapiv2/openapiv2.pb.go | 47 +++--- tag/tag.pb.go | 131 +++++++++++++++++ tag/tag.proto | 37 +++++ 12 files changed, 637 insertions(+), 116 deletions(-) create mode 100644 api/micro.pb.go create mode 100644 api/micro.proto create mode 100644 tag/tag.pb.go create mode 100644 tag/tag.proto diff --git a/api/annotations.pb.go b/api/annotations.pb.go index 82623fa..d1ea072 100644 --- a/api/annotations.pb.go +++ b/api/annotations.pb.go @@ -14,17 +14,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.15.6 // source: api/annotations.proto package api import ( - proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" reflect "reflect" ) @@ -35,27 +34,51 @@ const ( _ = 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 - var file_api_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.MethodOptions)(nil), + ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*HttpRule)(nil), Field: 72295728, Name: "micro.api.http", Tag: "bytes,72295728,opt,name=http", Filename: "api/annotations.proto", }, + { + ExtendedType: (*descriptorpb.MethodOptions)(nil), + ExtensionType: (*MicroMethod)(nil), + Field: 65535655, + Name: "micro.api.micro_method", + Tag: "bytes,65535655,opt,name=micro_method", + Filename: "api/annotations.proto", + }, + { + ExtendedType: (*descriptorpb.ServiceOptions)(nil), + ExtensionType: (*MicroService)(nil), + Field: 65535655, + Name: "micro.api.micro_service", + Tag: "bytes,65535655,opt,name=micro_service", + Filename: "api/annotations.proto", + }, } -// Extension fields to descriptor.MethodOptions. +// Extension fields to descriptorpb.MethodOptions. var ( // See `HttpRule`. // // optional micro.api.HttpRule http = 72295728; E_Http = &file_api_annotations_proto_extTypes[0] + // See `MicroMethod`. + // + // optional micro.api.MicroMethod micro_method = 65535655; + E_MicroMethod = &file_api_annotations_proto_extTypes[1] +) + +// Extension fields to descriptorpb.ServiceOptions. +var ( + // See `MicroService` + // + // optional micro.api.MicroService micro_service = 65535655; + E_MicroService = &file_api_annotations_proto_extTypes[2] ) var File_api_annotations_proto protoreflect.FileDescriptor @@ -64,32 +87,52 @@ var file_api_annotations_proto_rawDesc = []byte{ 0x0a, 0x15, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x0e, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x4a, 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, 0x12, 0x1e, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb0, 0xca, 0xbc, - 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, - 0x42, 0x53, 0x0a, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x10, 0x41, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x2b, 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, 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0xa2, 0x02, - 0x04, 0x4d, 0x41, 0x50, 0x49, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x6f, 0x1a, 0x0f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x4a, 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, 0x12, 0x1e, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb0, 0xca, + 0xbc, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x68, 0x74, 0x74, + 0x70, 0x3a, 0x5c, 0x0a, 0x0c, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0xa7, 0xfd, 0x9f, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x69, 0x63, + 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x52, 0x0b, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3a, + 0x60, 0x0a, 0x0d, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0xa7, 0xfd, 0x9f, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x69, 0x63, + 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x52, 0x0c, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x42, 0x53, 0x0a, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x10, + 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x2b, 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, 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0xa2, + 0x02, 0x04, 0x4d, 0x41, 0x50, 0x49, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_api_annotations_proto_goTypes = []interface{}{ - (*descriptor.MethodOptions)(nil), // 0: google.protobuf.MethodOptions - (*HttpRule)(nil), // 1: micro.api.HttpRule + (*descriptorpb.MethodOptions)(nil), // 0: google.protobuf.MethodOptions + (*descriptorpb.ServiceOptions)(nil), // 1: google.protobuf.ServiceOptions + (*HttpRule)(nil), // 2: micro.api.HttpRule + (*MicroMethod)(nil), // 3: micro.api.MicroMethod + (*MicroService)(nil), // 4: micro.api.MicroService } var file_api_annotations_proto_depIdxs = []int32{ 0, // 0: micro.api.http:extendee -> google.protobuf.MethodOptions - 1, // 1: micro.api.http:type_name -> micro.api.HttpRule - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 1, // [1:2] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee + 0, // 1: micro.api.micro_method:extendee -> google.protobuf.MethodOptions + 1, // 2: micro.api.micro_service:extendee -> google.protobuf.ServiceOptions + 2, // 3: micro.api.http:type_name -> micro.api.HttpRule + 3, // 4: micro.api.micro_method:type_name -> micro.api.MicroMethod + 4, // 5: micro.api.micro_service:type_name -> micro.api.MicroService + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 3, // [3:6] is the sub-list for extension type_name + 0, // [0:3] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -99,6 +142,7 @@ func file_api_annotations_proto_init() { return } file_api_http_proto_init() + file_api_micro_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ @@ -106,7 +150,7 @@ func file_api_annotations_proto_init() { RawDescriptor: file_api_annotations_proto_rawDesc, NumEnums: 0, NumMessages: 0, - NumExtensions: 1, + NumExtensions: 3, NumServices: 0, }, GoTypes: file_api_annotations_proto_goTypes, diff --git a/api/annotations.proto b/api/annotations.proto index b13cfbd..dba854a 100644 --- a/api/annotations.proto +++ b/api/annotations.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package micro.api; import "api/http.proto"; +import "api/micro.proto"; import "google/protobuf/descriptor.proto"; option go_package = "github.com/unistack-org/micro-proto/api;api"; @@ -29,3 +30,13 @@ extend google.protobuf.MethodOptions { // See `HttpRule`. HttpRule http = 72295728; } + +extend google.protobuf.MethodOptions { + // See `MicroMethod`. + MicroMethod micro_method = 65535655; +} + +extend google.protobuf.ServiceOptions { + // See `MicroService` + MicroService micro_service = 65535655; +} diff --git a/api/field_behavior.pb.go b/api/field_behavior.pb.go index e6b86bd..9ed1544 100644 --- a/api/field_behavior.pb.go +++ b/api/field_behavior.pb.go @@ -14,17 +14,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.15.6 // source: api/field_behavior.proto package api import ( - proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" reflect "reflect" sync "sync" ) @@ -36,10 +35,6 @@ const ( _ = 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 - // An indicator of the behavior of a given field (for example, that a field // is required in requests, or given as output but ignored as input). // This **does not** change the behavior in protocol buffers itself; it only @@ -130,7 +125,7 @@ func (FieldBehavior) EnumDescriptor() ([]byte, []int) { var file_api_field_behavior_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: ([]FieldBehavior)(nil), Field: 1052, Name: "micro.api.field_behavior", @@ -139,7 +134,7 @@ var file_api_field_behavior_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.FieldOptions. +// Extension fields to descriptorpb.FieldOptions. var ( // A designation of a specific field behavior (required, output only, etc.) // in protobuf messages. @@ -203,8 +198,8 @@ func file_api_field_behavior_proto_rawDescGZIP() []byte { var file_api_field_behavior_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_api_field_behavior_proto_goTypes = []interface{}{ - (FieldBehavior)(0), // 0: micro.api.FieldBehavior - (*descriptor.FieldOptions)(nil), // 1: google.protobuf.FieldOptions + (FieldBehavior)(0), // 0: micro.api.FieldBehavior + (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions } var file_api_field_behavior_proto_depIdxs = []int32{ 1, // 0: micro.api.field_behavior:extendee -> google.protobuf.FieldOptions diff --git a/api/http.pb.go b/api/http.pb.go index ce14f6f..f8a573f 100644 --- a/api/http.pb.go +++ b/api/http.pb.go @@ -14,14 +14,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.15.6 // source: api/http.proto package api import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -35,10 +34,6 @@ const ( _ = 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 - // Defines the HTTP configuration for an API service. It contains a list of // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method // to one or more HTTP REST API methods. diff --git a/api/httpbody.pb.go b/api/httpbody.pb.go index e308879..0b2b306 100644 --- a/api/httpbody.pb.go +++ b/api/httpbody.pb.go @@ -14,17 +14,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.15.6 // source: api/httpbody.proto package api import ( - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" sync "sync" ) @@ -36,10 +35,6 @@ const ( _ = 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 HTTP body. It should only be used for // payload formats that can't be represented as JSON, such as raw binary or // an HTML page. @@ -90,7 +85,7 @@ type HttpBody struct { Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // Application specific response metadata. Must be set in the first response // for streaming APIs. - Extensions []*any.Any `protobuf:"bytes,3,rep,name=extensions,proto3" json:"extensions,omitempty"` + Extensions []*anypb.Any `protobuf:"bytes,3,rep,name=extensions,proto3" json:"extensions,omitempty"` } func (x *HttpBody) Reset() { @@ -139,7 +134,7 @@ func (x *HttpBody) GetData() []byte { return nil } -func (x *HttpBody) GetExtensions() []*any.Any { +func (x *HttpBody) GetExtensions() []*anypb.Any { if x != nil { return x.Extensions } @@ -182,8 +177,8 @@ func file_api_httpbody_proto_rawDescGZIP() []byte { var file_api_httpbody_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_api_httpbody_proto_goTypes = []interface{}{ - (*HttpBody)(nil), // 0: micro.api.HttpBody - (*any.Any)(nil), // 1: google.protobuf.Any + (*HttpBody)(nil), // 0: micro.api.HttpBody + (*anypb.Any)(nil), // 1: google.protobuf.Any } var file_api_httpbody_proto_depIdxs = []int32{ 1, // 0: micro.api.HttpBody.extensions:type_name -> google.protobuf.Any diff --git a/api/micro.pb.go b/api/micro.pb.go new file mode 100644 index 0000000..ff5cf19 --- /dev/null +++ b/api/micro.pb.go @@ -0,0 +1,275 @@ +// Copyright 2020 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.26.0 +// protoc v3.15.6 +// source: api/micro.proto + +package api + +import ( + 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) +) + +// Defines the Micro configuration for a method. It contains a +// [MicroMethod][micro.api.MicroMethod] +type MicroMethod struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Timeout for handler + Timeout int32 `protobuf:"varint,1,opt,name=timeout,proto3" json:"timeout,omitempty"` + // ServerOptions contains options for server + ServerOptions []string `protobuf:"bytes,2,rep,name=server_options,json=serverOptions,proto3" json:"server_options,omitempty"` + // ClientOptions contains options for client + ClientOptions []string `protobuf:"bytes,3,rep,name=client_options,json=clientOptions,proto3" json:"client_options,omitempty"` + // Type rpc/pub/sub + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` +} + +func (x *MicroMethod) Reset() { + *x = MicroMethod{} + if protoimpl.UnsafeEnabled { + mi := &file_api_micro_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MicroMethod) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MicroMethod) ProtoMessage() {} + +func (x *MicroMethod) ProtoReflect() protoreflect.Message { + mi := &file_api_micro_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 MicroMethod.ProtoReflect.Descriptor instead. +func (*MicroMethod) Descriptor() ([]byte, []int) { + return file_api_micro_proto_rawDescGZIP(), []int{0} +} + +func (x *MicroMethod) GetTimeout() int32 { + if x != nil { + return x.Timeout + } + return 0 +} + +func (x *MicroMethod) GetServerOptions() []string { + if x != nil { + return x.ServerOptions + } + return nil +} + +func (x *MicroMethod) GetClientOptions() []string { + if x != nil { + return x.ClientOptions + } + return nil +} + +func (x *MicroMethod) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +// Defines the Micro configuration for a method. It contains a +// [MicroService][micro.api.MicroService] +type MicroService struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ServerWrappers contains wrappers for server + ServerWrappers []string `protobuf:"bytes,1,rep,name=server_wrappers,json=serverWrappers,proto3" json:"server_wrappers,omitempty"` + // ClientWrappers contains wrappers for client + ClientWrappers []string `protobuf:"bytes,2,rep,name=client_wrappers,json=clientWrappers,proto3" json:"client_wrappers,omitempty"` +} + +func (x *MicroService) Reset() { + *x = MicroService{} + if protoimpl.UnsafeEnabled { + mi := &file_api_micro_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MicroService) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MicroService) ProtoMessage() {} + +func (x *MicroService) ProtoReflect() protoreflect.Message { + mi := &file_api_micro_proto_msgTypes[1] + 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 MicroService.ProtoReflect.Descriptor instead. +func (*MicroService) Descriptor() ([]byte, []int) { + return file_api_micro_proto_rawDescGZIP(), []int{1} +} + +func (x *MicroService) GetServerWrappers() []string { + if x != nil { + return x.ServerWrappers + } + return nil +} + +func (x *MicroService) GetClientWrappers() []string { + if x != nil { + return x.ClientWrappers + } + return nil +} + +var File_api_micro_proto protoreflect.FileDescriptor + +var file_api_micro_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x22, 0x89, 0x01, 0x0a, + 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, + 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x60, 0x0a, 0x0c, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, + 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x77, 0x72, 0x61, 0x70, + 0x70, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x42, 0x50, 0x0a, 0x09, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x0a, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 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, 0x61, 0x70, 0x69, 0x3b, 0x61, + 0x70, 0x69, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x04, 0x4d, 0x41, 0x50, 0x49, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_micro_proto_rawDescOnce sync.Once + file_api_micro_proto_rawDescData = file_api_micro_proto_rawDesc +) + +func file_api_micro_proto_rawDescGZIP() []byte { + file_api_micro_proto_rawDescOnce.Do(func() { + file_api_micro_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_micro_proto_rawDescData) + }) + return file_api_micro_proto_rawDescData +} + +var file_api_micro_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_micro_proto_goTypes = []interface{}{ + (*MicroMethod)(nil), // 0: micro.api.MicroMethod + (*MicroService)(nil), // 1: micro.api.MicroService +} +var file_api_micro_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_api_micro_proto_init() } +func file_api_micro_proto_init() { + if File_api_micro_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_micro_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MicroMethod); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_micro_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MicroService); 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_api_micro_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_micro_proto_goTypes, + DependencyIndexes: file_api_micro_proto_depIdxs, + MessageInfos: file_api_micro_proto_msgTypes, + }.Build() + File_api_micro_proto = out.File + file_api_micro_proto_rawDesc = nil + file_api_micro_proto_goTypes = nil + file_api_micro_proto_depIdxs = nil +} diff --git a/api/micro.proto b/api/micro.proto new file mode 100644 index 0000000..17fcbb3 --- /dev/null +++ b/api/micro.proto @@ -0,0 +1,46 @@ +// Copyright 2020 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.api; + +option cc_enable_arenas = true; +option go_package = "github.com/unistack-org/micro-proto/api;api"; +option java_multiple_files = true; +option java_outer_classname = "MicroProto"; +option java_package = "micro.api"; +option objc_class_prefix = "MAPI"; + +// Defines the Micro configuration for a method. It contains a +// [MicroMethod][micro.api.MicroMethod] +message MicroMethod { + // Timeout for handler + int32 timeout = 1; + // ServerOptions contains options for server + repeated string server_options = 2; + // ClientOptions contains options for client + repeated string client_options = 3; + // Type rpc/pub/sub + string type = 4; +} + +// Defines the Micro configuration for a method. It contains a +// [MicroService][micro.api.MicroService] +message MicroService { + // ServerWrappers contains wrappers for server + repeated string server_wrappers = 1; + // ClientWrappers contains wrappers for client + repeated string client_wrappers = 2; +} diff --git a/generate.go b/generate.go index 9d58bb5..862b291 100644 --- a/generate.go +++ b/generate.go @@ -4,5 +4,7 @@ package main //go:generate protoc -I. -I./api --go_out=paths=source_relative:. ./api/http.proto //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./api --go_out=paths=source_relative:. ./api/micro.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./tag --go_out=paths=source_relative:. ./tag/tag.proto diff --git a/openapiv2/annotations.pb.go b/openapiv2/annotations.pb.go index 9b0447a..c48a341 100644 --- a/openapiv2/annotations.pb.go +++ b/openapiv2/annotations.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.15.6 // source: openapiv2/annotations.proto package openapiv2 import ( - proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" reflect "reflect" ) @@ -21,13 +20,9 @@ const ( _ = 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 - var file_openapiv2_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.FileOptions)(nil), + ExtendedType: (*descriptorpb.FileOptions)(nil), ExtensionType: (*Swagger)(nil), Field: 1042, Name: "micro.openapiv2.openapiv2_swagger", @@ -35,7 +30,7 @@ var file_openapiv2_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "openapiv2/annotations.proto", }, { - ExtendedType: (*descriptor.MethodOptions)(nil), + ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*Operation)(nil), Field: 1042, Name: "micro.openapiv2.openapiv2_operation", @@ -43,7 +38,7 @@ var file_openapiv2_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "openapiv2/annotations.proto", }, { - ExtendedType: (*descriptor.MessageOptions)(nil), + ExtendedType: (*descriptorpb.MessageOptions)(nil), ExtensionType: (*Schema)(nil), Field: 1042, Name: "micro.openapiv2.openapiv2_schema", @@ -51,7 +46,7 @@ var file_openapiv2_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "openapiv2/annotations.proto", }, { - ExtendedType: (*descriptor.ServiceOptions)(nil), + ExtendedType: (*descriptorpb.ServiceOptions)(nil), ExtensionType: (*Tag)(nil), Field: 1042, Name: "micro.openapiv2.openapiv2_tag", @@ -59,7 +54,7 @@ var file_openapiv2_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "openapiv2/annotations.proto", }, { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*JSONSchema)(nil), Field: 1042, Name: "micro.openapiv2.openapiv2_field", @@ -68,7 +63,7 @@ var file_openapiv2_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.FileOptions. +// Extension fields to descriptorpb.FileOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // @@ -79,7 +74,7 @@ var ( E_Openapiv2Swagger = &file_openapiv2_annotations_proto_extTypes[0] ) -// Extension fields to descriptor.MethodOptions. +// Extension fields to descriptorpb.MethodOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // @@ -90,7 +85,7 @@ var ( E_Openapiv2Operation = &file_openapiv2_annotations_proto_extTypes[1] ) -// Extension fields to descriptor.MessageOptions. +// Extension fields to descriptorpb.MessageOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // @@ -101,7 +96,7 @@ var ( E_Openapiv2Schema = &file_openapiv2_annotations_proto_extTypes[2] ) -// Extension fields to descriptor.ServiceOptions. +// Extension fields to descriptorpb.ServiceOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // @@ -112,7 +107,7 @@ var ( E_Openapiv2Tag = &file_openapiv2_annotations_proto_extTypes[3] ) -// Extension fields to descriptor.FieldOptions. +// Extension fields to descriptorpb.FieldOptions. var ( // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. // @@ -172,16 +167,16 @@ var file_openapiv2_annotations_proto_rawDesc = []byte{ } var file_openapiv2_annotations_proto_goTypes = []interface{}{ - (*descriptor.FileOptions)(nil), // 0: google.protobuf.FileOptions - (*descriptor.MethodOptions)(nil), // 1: google.protobuf.MethodOptions - (*descriptor.MessageOptions)(nil), // 2: google.protobuf.MessageOptions - (*descriptor.ServiceOptions)(nil), // 3: google.protobuf.ServiceOptions - (*descriptor.FieldOptions)(nil), // 4: google.protobuf.FieldOptions - (*Swagger)(nil), // 5: micro.openapiv2.Swagger - (*Operation)(nil), // 6: micro.openapiv2.Operation - (*Schema)(nil), // 7: micro.openapiv2.Schema - (*Tag)(nil), // 8: micro.openapiv2.Tag - (*JSONSchema)(nil), // 9: micro.openapiv2.JSONSchema + (*descriptorpb.FileOptions)(nil), // 0: google.protobuf.FileOptions + (*descriptorpb.MethodOptions)(nil), // 1: google.protobuf.MethodOptions + (*descriptorpb.MessageOptions)(nil), // 2: google.protobuf.MessageOptions + (*descriptorpb.ServiceOptions)(nil), // 3: google.protobuf.ServiceOptions + (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions + (*Swagger)(nil), // 5: micro.openapiv2.Swagger + (*Operation)(nil), // 6: micro.openapiv2.Operation + (*Schema)(nil), // 7: micro.openapiv2.Schema + (*Tag)(nil), // 8: micro.openapiv2.Tag + (*JSONSchema)(nil), // 9: micro.openapiv2.JSONSchema } var file_openapiv2_annotations_proto_depIdxs = []int32{ 0, // 0: micro.openapiv2.openapiv2_swagger:extendee -> google.protobuf.FileOptions diff --git a/openapiv2/openapiv2.pb.go b/openapiv2/openapiv2.pb.go index 211272a..f04b343 100644 --- a/openapiv2/openapiv2.pb.go +++ b/openapiv2/openapiv2.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.6.1 +// protoc-gen-go v1.26.0 +// protoc v3.15.6 // source: openapiv2/openapiv2.proto package openapiv2 import ( - proto "github.com/golang/protobuf/proto" - _struct "github.com/golang/protobuf/ptypes/struct" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = 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 - // Scheme describes the schemes supported by the OpenAPI Swagger // and Operation objects. type Scheme int32 @@ -384,8 +379,8 @@ type Swagger struct { // Individual operations can override this definition. Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` // Additional external documentation. - ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Extensions map[string]*_struct.Value `protobuf:"bytes,15,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` + Extensions map[string]*structpb.Value `protobuf:"bytes,15,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Swagger) Reset() { @@ -497,7 +492,7 @@ func (x *Swagger) GetExternalDocs() *ExternalDocumentation { return nil } -func (x *Swagger) GetExtensions() map[string]*_struct.Value { +func (x *Swagger) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } @@ -573,8 +568,8 @@ type Operation struct { // (that is, there is a logical OR between the security requirements). This // definition overrides any declared top-level security. To remove a top-level // security declaration, an empty array can be used. - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - Extensions map[string]*_struct.Value `protobuf:"bytes,13,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` + Extensions map[string]*structpb.Value `protobuf:"bytes,13,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Operation) Reset() { @@ -686,7 +681,7 @@ func (x *Operation) GetSecurity() []*SecurityRequirement { return nil } -func (x *Operation) GetExtensions() map[string]*_struct.Value { +func (x *Operation) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } @@ -804,8 +799,8 @@ type Response struct { Headers map[string]*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // `Examples` gives per-mimetype response examples. // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object - Examples map[string]string `protobuf:"bytes,4,rep,name=examples,proto3" json:"examples,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Extensions map[string]*_struct.Value `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Examples map[string]string `protobuf:"bytes,4,rep,name=examples,proto3" json:"examples,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Extensions map[string]*structpb.Value `protobuf:"bytes,5,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Response) Reset() { @@ -868,7 +863,7 @@ func (x *Response) GetExamples() map[string]string { return nil } -func (x *Response) GetExtensions() map[string]*_struct.Value { +func (x *Response) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } @@ -917,8 +912,8 @@ type Info struct { License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` // Provides the version of the application API (not to be confused // with the specification version). - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` - Extensions map[string]*_struct.Value `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` + Extensions map[string]*structpb.Value `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Info) Reset() { @@ -995,7 +990,7 @@ func (x *Info) GetVersion() string { return "" } -func (x *Info) GetExtensions() map[string]*_struct.Value { +func (x *Info) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } @@ -1771,8 +1766,8 @@ type SecurityScheme struct { TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` // The available scopes for the OAuth2 security scheme. // Valid for oauth2. - Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` - Extensions map[string]*_struct.Value `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes,proto3" json:"scopes,omitempty"` + Extensions map[string]*structpb.Value `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *SecurityScheme) Reset() { @@ -1863,7 +1858,7 @@ func (x *SecurityScheme) GetScopes() *Scopes { return nil } -func (x *SecurityScheme) GetExtensions() map[string]*_struct.Value { +func (x *SecurityScheme) GetExtensions() map[string]*structpb.Value { if x != nil { return x.Extensions } @@ -2454,9 +2449,9 @@ var file_openapiv2_openapiv2_proto_goTypes = []interface{}{ nil, // 28: micro.openapiv2.SecurityDefinitions.SecurityEntry nil, // 29: micro.openapiv2.SecurityScheme.ExtensionsEntry (*SecurityRequirement_SecurityRequirementValue)(nil), // 30: micro.openapiv2.SecurityRequirement.SecurityRequirementValue - nil, // 31: micro.openapiv2.SecurityRequirement.SecurityRequirementEntry - nil, // 32: micro.openapiv2.Scopes.ScopeEntry - (*_struct.Value)(nil), // 33: google.protobuf.Value + nil, // 31: micro.openapiv2.SecurityRequirement.SecurityRequirementEntry + nil, // 32: micro.openapiv2.Scopes.ScopeEntry + (*structpb.Value)(nil), // 33: google.protobuf.Value } var file_openapiv2_openapiv2_proto_depIdxs = []int32{ 9, // 0: micro.openapiv2.Swagger.info:type_name -> micro.openapiv2.Info diff --git a/tag/tag.pb.go b/tag/tag.pb.go new file mode 100644 index 0000000..39a8458 --- /dev/null +++ b/tag/tag.pb.go @@ -0,0 +1,131 @@ +// Copyright 2020 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.26.0 +// protoc v3.15.6 +// source: tag/tag.proto + +package tag + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" +) + +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) +) + +var file_tag_tag_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 847939, + Name: "micro.tag.tags", + Tag: "bytes,847939,opt,name=tags", + Filename: "tag/tag.proto", + }, + { + ExtendedType: (*descriptorpb.OneofOptions)(nil), + ExtensionType: (*string)(nil), + Field: 847939, + Name: "micro.tag.oneof_tags", + Tag: "bytes,847939,opt,name=oneof_tags", + Filename: "tag/tag.proto", + }, +} + +// Extension fields to descriptorpb.FieldOptions. +var ( + // Multiple Tags can be spcified. + // + // optional string tags = 847939; + E_Tags = &file_tag_tag_proto_extTypes[0] +) + +// Extension fields to descriptorpb.OneofOptions. +var ( + // Multiple Tags can be spcified. + // + // optional string oneof_tags = 847939; + E_OneofTags = &file_tag_tag_proto_extTypes[1] +) + +var File_tag_tag_proto protoreflect.FileDescriptor + +var file_tag_tag_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x74, 0x61, 0x67, 0x2f, 0x74, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x74, 0x61, 0x67, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x33, 0x0a, 0x04, + 0x74, 0x61, 0x67, 0x73, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0xc3, 0xe0, 0x33, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x3a, 0x3e, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x12, + 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xc3, + 0xe0, 0x33, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x54, 0x61, 0x67, + 0x73, 0x42, 0x50, 0x0a, 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x74, 0x61, 0x67, 0x42, 0x0a, + 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 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, 0x74, 0x61, 0x67, 0x3b, 0x74, 0x61, 0x67, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x04, 0x4d, + 0x54, 0x41, 0x47, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_tag_tag_proto_goTypes = []interface{}{ + (*descriptorpb.FieldOptions)(nil), // 0: google.protobuf.FieldOptions + (*descriptorpb.OneofOptions)(nil), // 1: google.protobuf.OneofOptions +} +var file_tag_tag_proto_depIdxs = []int32{ + 0, // 0: micro.tag.tags:extendee -> google.protobuf.FieldOptions + 1, // 1: micro.tag.oneof_tags:extendee -> google.protobuf.OneofOptions + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 0, // [0:2] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_tag_tag_proto_init() } +func file_tag_tag_proto_init() { + if File_tag_tag_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_tag_tag_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 2, + NumServices: 0, + }, + GoTypes: file_tag_tag_proto_goTypes, + DependencyIndexes: file_tag_tag_proto_depIdxs, + ExtensionInfos: file_tag_tag_proto_extTypes, + }.Build() + File_tag_tag_proto = out.File + file_tag_tag_proto_rawDesc = nil + file_tag_tag_proto_goTypes = nil + file_tag_tag_proto_depIdxs = nil +} diff --git a/tag/tag.proto b/tag/tag.proto new file mode 100644 index 0000000..6fff37b --- /dev/null +++ b/tag/tag.proto @@ -0,0 +1,37 @@ +// Copyright 2020 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.tag; + +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option go_package = "github.com/unistack-org/micro-proto/tag;tag"; +option java_multiple_files = true; +option java_outer_classname = "MicroProto"; +option java_package = "micro.tag"; +option objc_class_prefix = "MTAG"; + +// Tags are applied at the field level +extend google.protobuf.FieldOptions { + // Multiple Tags can be spcified. + string tags = 847939; +} + +extend google.protobuf.OneofOptions { + // Multiple Tags can be spcified. + string oneof_tags = 847939; +}