Prechádzať zdrojové kódy

feat(api): 添加 McpOptions并扩展 Options 消息

- 在 annotations.proto 文件中添加了 McpOptions 消息类型
- 在 Options 消息中添加了 mcp_options 字段,类型为 McpOptions
- 更新了 annotations.pb.go 文件以支持新的 McpOptions 类型
dcsunny 4 mesiacov pred
rodič
commit
3eb1e14d71

+ 106 - 29
kuban/api/annotations/annotations.pb.go

@@ -29,6 +29,8 @@ type Options struct {
 
 	// 操作记录
 	OperationRecord *OperationRecord `protobuf:"bytes,2,opt,name=operation_record,json=operationRecord,proto3" json:"operation_record"`
+	// mcp 配置
+	McpOptions *McpOptions `protobuf:"bytes,3,opt,name=mcp_options,json=mcpOptions,proto3" json:"mcp_options"`
 }
 
 func (x *Options) Reset() {
@@ -70,6 +72,13 @@ func (x *Options) GetOperationRecord() *OperationRecord {
 	return &OperationRecord{}
 }
 
+func (x *Options) GetMcpOptions() *McpOptions {
+	if x != nil && x.McpOptions != nil {
+		return x.McpOptions
+	}
+	return &McpOptions{}
+}
+
 // 操作记录
 type OperationRecord struct {
 	state         protoimpl.MessageState
@@ -119,6 +128,54 @@ func (x *OperationRecord) GetEnabled() bool {
 	return false
 }
 
+type McpOptions struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	// 是否生成mcp
+	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled"`
+}
+
+func (x *McpOptions) Reset() {
+	*x = McpOptions{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_kuban_api_annotations_proto_msgTypes[2]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *McpOptions) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*McpOptions) ProtoMessage() {}
+
+func (x *McpOptions) ProtoReflect() protoreflect.Message {
+	mi := &file_kuban_api_annotations_proto_msgTypes[2]
+	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 McpOptions.ProtoReflect.Descriptor instead.
+func (*McpOptions) Descriptor() ([]byte, []int) {
+	return file_kuban_api_annotations_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *McpOptions) GetEnabled() bool {
+	if x != nil {
+		return x.Enabled
+	}
+	return false
+}
+
 var file_kuban_api_annotations_proto_extTypes = []protoimpl.ExtensionInfo{
 	{
 		ExtendedType:  (*descriptorpb.MethodOptions)(nil),
@@ -143,25 +200,31 @@ var file_kuban_api_annotations_proto_rawDesc = []byte{
 	0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6b,
 	0x75, 0x62, 0x61, 0x6e, 0x2e, 0x61, 0x70, 0x69, 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, 0x22, 0x50, 0x0a, 0x07, 0x4f, 0x70,
-	0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
-	0x1a, 0x2e, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x70, 0x65, 0x72,
-	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x0f, 0x6f, 0x70, 0x65,
-	0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x2b, 0x0a, 0x0f,
-	0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12,
-	0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
-	0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3a, 0x4d, 0x0a, 0x07, 0x6f, 0x70, 0x74,
-	0x69, 0x6f, 0x6e, 0x73, 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, 0x92, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6b, 0x75,
-	0x62, 0x61, 0x6e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
-	0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x2e,
-	0x69, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
-	0x72, 0x2f, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x6b, 0x75, 0x62, 0x61,
-	0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
-	0x73, 0x3b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70,
-	0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x01, 0x0a, 0x07, 0x4f,
+	0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
+	0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
+	0x32, 0x1a, 0x2e, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x70, 0x65,
+	0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x0f, 0x6f, 0x70,
+	0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a,
+	0x0b, 0x6d, 0x63, 0x70, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d,
+	0x63, 0x70, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x6d, 0x63, 0x70, 0x4f, 0x70,
+	0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2b, 0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
+	0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62,
+	0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+	0x65, 0x64, 0x22, 0x26, 0x0a, 0x0a, 0x4d, 0x63, 0x70, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+	0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3a, 0x4d, 0x0a, 0x07, 0x6f, 0x70,
+	0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 0x92, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6b,
+	0x75, 0x62, 0x61, 0x6e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+	0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74,
+	0x2e, 0x69, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76,
+	0x65, 0x72, 0x2f, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x6b, 0x75, 0x62,
+	0x61, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,
+	0x6e, 0x73, 0x3b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06,
+	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -176,21 +239,23 @@ func file_kuban_api_annotations_proto_rawDescGZIP() []byte {
 	return file_kuban_api_annotations_proto_rawDescData
 }
 
-var file_kuban_api_annotations_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_kuban_api_annotations_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
 var file_kuban_api_annotations_proto_goTypes = []interface{}{
 	(*Options)(nil),                    // 0: kuban.api.Options
 	(*OperationRecord)(nil),            // 1: kuban.api.OperationRecord
-	(*descriptorpb.MethodOptions)(nil), // 2: google.protobuf.MethodOptions
+	(*McpOptions)(nil),                 // 2: kuban.api.McpOptions
+	(*descriptorpb.MethodOptions)(nil), // 3: google.protobuf.MethodOptions
 }
 var file_kuban_api_annotations_proto_depIdxs = []int32{
 	1, // 0: kuban.api.Options.operation_record:type_name -> kuban.api.OperationRecord
-	2, // 1: kuban.api.options:extendee -> google.protobuf.MethodOptions
-	0, // 2: kuban.api.options:type_name -> kuban.api.Options
-	3, // [3:3] is the sub-list for method output_type
-	3, // [3:3] is the sub-list for method input_type
-	2, // [2:3] is the sub-list for extension type_name
-	1, // [1:2] is the sub-list for extension extendee
-	0, // [0:1] is the sub-list for field type_name
+	2, // 1: kuban.api.Options.mcp_options:type_name -> kuban.api.McpOptions
+	3, // 2: kuban.api.options:extendee -> google.protobuf.MethodOptions
+	0, // 3: kuban.api.options:type_name -> kuban.api.Options
+	4, // [4:4] is the sub-list for method output_type
+	4, // [4:4] is the sub-list for method input_type
+	3, // [3:4] is the sub-list for extension type_name
+	2, // [2:3] is the sub-list for extension extendee
+	0, // [0:2] is the sub-list for field type_name
 }
 
 func init() { file_kuban_api_annotations_proto_init() }
@@ -223,6 +288,18 @@ func file_kuban_api_annotations_proto_init() {
 				return nil
 			}
 		}
+		file_kuban_api_annotations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*McpOptions); 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{
@@ -230,7 +307,7 @@ func file_kuban_api_annotations_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_kuban_api_annotations_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   2,
+			NumMessages:   3,
 			NumExtensions: 1,
 			NumServices:   0,
 		},

+ 31 - 0
proto/google/api/annotations.proto

@@ -0,0 +1,31 @@
+// Copyright (c) 2015, Google Inc.
+//
+// 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 google.api;
+
+import "google/api/http.proto";
+import "google/protobuf/descriptor.proto";
+
+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
+option java_multiple_files = true;
+option java_outer_classname = "AnnotationsProto";
+option java_package = "com.google.api";
+option objc_class_prefix = "GAPI";
+
+extend google.protobuf.MethodOptions {
+  // See `HttpRule`.
+  HttpRule http = 72295728;
+}

+ 101 - 0
proto/google/api/client.proto

@@ -0,0 +1,101 @@
+// Copyright 2019 Google 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
+//
+//     https://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 google.api;
+
+import "google/protobuf/descriptor.proto";
+
+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
+option java_multiple_files = true;
+option java_outer_classname = "ClientProto";
+option java_package = "com.google.api";
+option objc_class_prefix = "GAPI";
+
+
+extend google.protobuf.ServiceOptions {
+  // The hostname for this service.
+  // This should be specified with no prefix or protocol.
+  //
+  // Example:
+  //
+  //   service Foo {
+  //     option (google.api.default_host) = "foo.googleapi.com";
+  //     ...
+  //   }
+  string default_host = 1049;
+
+  // OAuth scopes needed for the client.
+  //
+  // Example:
+  //
+  //   service Foo {
+  //     option (google.api.oauth_scopes) = \
+  //       "https://www.googleapis.com/auth/cloud-platform";
+  //     ...
+  //   }
+  //
+  // If there is more than one scope, use a comma-separated string:
+  //
+  // Example:
+  //
+  //   service Foo {
+  //     option (google.api.oauth_scopes) = \
+  //       "https://www.googleapis.com/auth/cloud-platform,"
+  //       "https://www.googleapis.com/auth/monitoring";
+  //     ...
+  //   }
+  string oauth_scopes = 1050;
+}
+
+
+extend google.protobuf.MethodOptions {
+  // A definition of a client library method signature.
+  //
+  // In client libraries, each proto RPC corresponds to one or more methods
+  // which the end user is able to call, and calls the underlying RPC.
+  // Normally, this method receives a single argument (a struct or instance
+  // corresponding to the RPC request object). Defining this field will
+  // add one or more overloads providing flattened or simpler method signatures
+  // in some languages.
+  //
+  // The fields on the method signature are provided as a comma-separated
+  // string.
+  //
+  // For example, the proto RPC and annotation:
+  //
+  //   rpc CreateSubscription(CreateSubscriptionRequest)
+  //       returns (Subscription) {
+  //     option (google.api.method_signature) = "name,topic";
+  //   }
+  //
+  // Would add the following Java overload (in addition to the method accepting
+  // the request object):
+  //
+  //   public final Subscription createSubscription(String name, String topic)
+  //
+  // The following backwards-compatibility guidelines apply:
+  //
+  //   * Adding this annotation to an unannotated method is backwards
+  //     compatible.
+  //   * Adding this annotation to a method which already has existing
+  //     method signature annotations is backwards compatible if and only if
+  //     the new method signature annotation is last in the sequence.
+  //   * Modifying or removing an existing method signature annotation is
+  //     a breaking change.
+  //   * Re-ordering existing method signature annotations is a breaking
+  //     change.
+  repeated string method_signature = 1051;
+}

+ 80 - 0
proto/google/api/field_behavior.proto

@@ -0,0 +1,80 @@
+// Copyright 2019 Google 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
+//
+//     https://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 google.api;
+
+import "google/protobuf/descriptor.proto";
+
+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
+option java_multiple_files = true;
+option java_outer_classname = "FieldBehaviorProto";
+option java_package = "com.google.api";
+option objc_class_prefix = "GAPI";
+
+
+// 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
+// denotes the behavior and may affect how API tooling handles the field.
+//
+// Note: This enum **may** receive new values in the future.
+enum FieldBehavior {
+  // Conventional default for enums. Do not use this.
+  FIELD_BEHAVIOR_UNSPECIFIED = 0;
+
+  // Specifically denotes a field as optional.
+  // While all fields in protocol buffers are optional, this may be specified
+  // for emphasis if appropriate.
+  OPTIONAL = 1;
+
+  // Denotes a field as required.
+  // This indicates that the field **must** be provided as part of the request,
+  // and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
+  REQUIRED = 2;
+
+  // Denotes a field as output only.
+  // This indicates that the field is provided in responses, but including the
+  // field in a request does nothing (the server *must* ignore it and
+  // *must not* throw an error as a result of the field's presence).
+  OUTPUT_ONLY = 3;
+
+  // Denotes a field as input only.
+  // This indicates that the field is provided in requests, and the
+  // corresponding field is not included in output.
+  INPUT_ONLY = 4;
+
+  // Denotes a field as immutable.
+  // This indicates that the field may be set once in a request to create a
+  // resource, but may not be changed thereafter.
+  IMMUTABLE = 5;
+}
+
+
+extend google.protobuf.FieldOptions {
+  // A designation of a specific field behavior (required, output only, etc.)
+  // in protobuf messages.
+  //
+  // Examples:
+  //
+  //   string name = 1 [(google.api.field_behavior) = REQUIRED];
+  //   State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
+  //   google.protobuf.Duration ttl = 1
+  //     [(google.api.field_behavior) = INPUT_ONLY];
+  //   google.protobuf.Timestamp expire_time = 1
+  //     [(google.api.field_behavior) = OUTPUT_ONLY,
+  //      (google.api.field_behavior) = IMMUTABLE];
+  repeated FieldBehavior field_behavior = 1052;
+}

+ 375 - 0
proto/google/api/http.proto

@@ -0,0 +1,375 @@
+// Copyright 2020 Google 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 google.api;
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
+option java_multiple_files = true;
+option java_outer_classname = "HttpProto";
+option java_package = "com.google.api";
+option objc_class_prefix = "GAPI";
+
+// 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.
+message Http {
+  // A list of HTTP configuration rules that apply to individual API methods.
+  //
+  // **NOTE:** All service configuration rules follow "last one wins" order.
+  repeated HttpRule rules = 1;
+
+  // When set to true, URL path parameters will be fully URI-decoded except in
+  // cases of single segment matches in reserved expansion, where "%2F" will be
+  // left encoded.
+  //
+  // The default behavior is to not decode RFC 6570 reserved characters in multi
+  // segment matches.
+  bool fully_decode_reserved_expansion = 2;
+}
+
+// # gRPC Transcoding
+//
+// gRPC Transcoding is a feature for mapping between a gRPC method and one or
+// more HTTP REST endpoints. It allows developers to build a single API service
+// that supports both gRPC APIs and REST APIs. Many systems, including [Google
+// APIs](https://github.com/googleapis/googleapis),
+// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
+// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
+// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
+// and use it for large scale production services.
+//
+// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
+// how different portions of the gRPC request message are mapped to the URL
+// path, URL query parameters, and HTTP request body. It also controls how the
+// gRPC response message is mapped to the HTTP response body. `HttpRule` is
+// typically specified as an `google.api.http` annotation on the gRPC method.
+//
+// Each mapping specifies a URL path template and an HTTP method. The path
+// template may refer to one or more fields in the gRPC request message, as long
+// as each field is a non-repeated field with a primitive (non-message) type.
+// The path template controls how fields of the request message are mapped to
+// the URL path.
+//
+// Example:
+//
+//     service Messaging {
+//       rpc GetMessage(GetMessageRequest) returns (Message) {
+//         option (google.api.http) = {
+//             get: "/v1/{name=messages/*}"
+//         };
+//       }
+//     }
+//     message GetMessageRequest {
+//       string name = 1; // Mapped to URL path.
+//     }
+//     message Message {
+//       string text = 1; // The resource content.
+//     }
+//
+// This enables an HTTP REST to gRPC mapping as below:
+//
+// HTTP | gRPC
+// -----|-----
+// `GET /v1/messages/123456`  | `GetMessage(name: "messages/123456")`
+//
+// Any fields in the request message which are not bound by the path template
+// automatically become HTTP query parameters if there is no HTTP request body.
+// For example:
+//
+//     service Messaging {
+//       rpc GetMessage(GetMessageRequest) returns (Message) {
+//         option (google.api.http) = {
+//             get:"/v1/messages/{message_id}"
+//         };
+//       }
+//     }
+//     message GetMessageRequest {
+//       message SubMessage {
+//         string subfield = 1;
+//       }
+//       string message_id = 1; // Mapped to URL path.
+//       int64 revision = 2;    // Mapped to URL query parameter `revision`.
+//       SubMessage sub = 3;    // Mapped to URL query parameter `sub.subfield`.
+//     }
+//
+// This enables a HTTP JSON to RPC mapping as below:
+//
+// HTTP | gRPC
+// -----|-----
+// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
+// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
+// "foo"))`
+//
+// Note that fields which are mapped to URL query parameters must have a
+// primitive type or a repeated primitive type or a non-repeated message type.
+// In the case of a repeated type, the parameter can be repeated in the URL
+// as `...?param=A&param=B`. In the case of a message type, each field of the
+// message is mapped to a separate parameter, such as
+// `...?foo.a=A&foo.b=B&foo.c=C`.
+//
+// For HTTP methods that allow a request body, the `body` field
+// specifies the mapping. Consider a REST update method on the
+// message resource collection:
+//
+//     service Messaging {
+//       rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
+//         option (google.api.http) = {
+//           patch: "/v1/messages/{message_id}"
+//           body: "message"
+//         };
+//       }
+//     }
+//     message UpdateMessageRequest {
+//       string message_id = 1; // mapped to the URL
+//       Message message = 2;   // mapped to the body
+//     }
+//
+// The following HTTP JSON to RPC mapping is enabled, where the
+// representation of the JSON in the request body is determined by
+// protos JSON encoding:
+//
+// HTTP | gRPC
+// -----|-----
+// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
+// "123456" message { text: "Hi!" })`
+//
+// The special name `*` can be used in the body mapping to define that
+// every field not bound by the path template should be mapped to the
+// request body.  This enables the following alternative definition of
+// the update method:
+//
+//     service Messaging {
+//       rpc UpdateMessage(Message) returns (Message) {
+//         option (google.api.http) = {
+//           patch: "/v1/messages/{message_id}"
+//           body: "*"
+//         };
+//       }
+//     }
+//     message Message {
+//       string message_id = 1;
+//       string text = 2;
+//     }
+//
+//
+// The following HTTP JSON to RPC mapping is enabled:
+//
+// HTTP | gRPC
+// -----|-----
+// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
+// "123456" text: "Hi!")`
+//
+// Note that when using `*` in the body mapping, it is not possible to
+// have HTTP parameters, as all fields not bound by the path end in
+// the body. This makes this option more rarely used in practice when
+// defining REST APIs. The common usage of `*` is in custom methods
+// which don't use the URL at all for transferring data.
+//
+// It is possible to define multiple HTTP methods for one RPC by using
+// the `additional_bindings` option. Example:
+//
+//     service Messaging {
+//       rpc GetMessage(GetMessageRequest) returns (Message) {
+//         option (google.api.http) = {
+//           get: "/v1/messages/{message_id}"
+//           additional_bindings {
+//             get: "/v1/users/{user_id}/messages/{message_id}"
+//           }
+//         };
+//       }
+//     }
+//     message GetMessageRequest {
+//       string message_id = 1;
+//       string user_id = 2;
+//     }
+//
+// This enables the following two alternative HTTP JSON to RPC mappings:
+//
+// HTTP | gRPC
+// -----|-----
+// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
+// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
+// "123456")`
+//
+// ## Rules for HTTP mapping
+//
+// 1. Leaf request fields (recursive expansion nested messages in the request
+//    message) are classified into three categories:
+//    - Fields referred by the path template. They are passed via the URL path.
+//    - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
+//      request body.
+//    - All other fields are passed via the URL query parameters, and the
+//      parameter name is the field path in the request message. A repeated
+//      field can be represented as multiple query parameters under the same
+//      name.
+//  2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
+//     are passed via URL path and HTTP request body.
+//  3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
+//     fields are passed via URL path and URL query parameters.
+//
+// ### Path template syntax
+//
+//     Template = "/" Segments [ Verb ] ;
+//     Segments = Segment { "/" Segment } ;
+//     Segment  = "*" | "**" | LITERAL | Variable ;
+//     Variable = "{" FieldPath [ "=" Segments ] "}" ;
+//     FieldPath = IDENT { "." IDENT } ;
+//     Verb     = ":" LITERAL ;
+//
+// The syntax `*` matches a single URL path segment. The syntax `**` matches
+// zero or more URL path segments, which must be the last part of the URL path
+// except the `Verb`.
+//
+// The syntax `Variable` matches part of the URL path as specified by its
+// template. A variable template must not contain other variables. If a variable
+// matches a single path segment, its template may be omitted, e.g. `{var}`
+// is equivalent to `{var=*}`.
+//
+// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
+// contains any reserved character, such characters should be percent-encoded
+// before the matching.
+//
+// If a variable contains exactly one path segment, such as `"{var}"` or
+// `"{var=*}"`, when such a variable is expanded into a URL path on the client
+// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
+// server side does the reverse decoding. Such variables show up in the
+// [Discovery
+// Document](https://developers.google.com/discovery/v1/reference/apis) as
+// `{var}`.
+//
+// If a variable contains multiple path segments, such as `"{var=foo/*}"`
+// or `"{var=**}"`, when such a variable is expanded into a URL path on the
+// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
+// The server side does the reverse decoding, except "%2F" and "%2f" are left
+// unchanged. Such variables show up in the
+// [Discovery
+// Document](https://developers.google.com/discovery/v1/reference/apis) as
+// `{+var}`.
+//
+// ## Using gRPC API Service Configuration
+//
+// gRPC API Service Configuration (service config) is a configuration language
+// for configuring a gRPC service to become a user-facing product. The
+// service config is simply the YAML representation of the `google.api.Service`
+// proto message.
+//
+// As an alternative to annotating your proto file, you can configure gRPC
+// transcoding in your service config YAML files. You do this by specifying a
+// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
+// effect as the proto annotation. This can be particularly useful if you
+// have a proto that is reused in multiple services. Note that any transcoding
+// specified in the service config will override any matching transcoding
+// configuration in the proto.
+//
+// Example:
+//
+//     http:
+//       rules:
+//         # Selects a gRPC method and applies HttpRule to it.
+//         - selector: example.v1.Messaging.GetMessage
+//           get: /v1/messages/{message_id}/{sub.subfield}
+//
+// ## Special notes
+//
+// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
+// proto to JSON conversion must follow the [proto3
+// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
+//
+// While the single segment variable follows the semantics of
+// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
+// Expansion, the multi segment variable **does not** follow RFC 6570 Section
+// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
+// does not expand special characters like `?` and `#`, which would lead
+// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
+// for multi segment variables.
+//
+// The path variables **must not** refer to any repeated or mapped field,
+// because client libraries are not capable of handling such variable expansion.
+//
+// The path variables **must not** capture the leading "/" character. The reason
+// is that the most common use case "{var}" does not capture the leading "/"
+// character. For consistency, all path variables must share the same behavior.
+//
+// Repeated message fields must not be mapped to URL query parameters, because
+// no client library can support such complicated mapping.
+//
+// If an API needs to use a JSON array for request or response body, it can map
+// the request or response body to a repeated field. However, some gRPC
+// Transcoding implementations may not support this feature.
+message HttpRule {
+  // Selects a method to which this rule applies.
+  //
+  // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
+  string selector = 1;
+
+  // Determines the URL pattern is matched by this rules. This pattern can be
+  // used with any of the {get|put|post|delete|patch} methods. A custom method
+  // can be defined using the 'custom' field.
+  oneof pattern {
+    // Maps to HTTP GET. Used for listing and getting information about
+    // resources.
+    string get = 2;
+
+    // Maps to HTTP PUT. Used for replacing a resource.
+    string put = 3;
+
+    // Maps to HTTP POST. Used for creating a resource or performing an action.
+    string post = 4;
+
+    // Maps to HTTP DELETE. Used for deleting a resource.
+    string delete = 5;
+
+    // Maps to HTTP PATCH. Used for updating a resource.
+    string patch = 6;
+
+    // The custom pattern is used for specifying an HTTP method that is not
+    // included in the `pattern` field, such as HEAD, or "*" to leave the
+    // HTTP method unspecified for this rule. The wild-card rule is useful
+    // for services that provide content to Web (HTML) clients.
+    CustomHttpPattern custom = 8;
+  }
+
+  // The name of the request field whose value is mapped to the HTTP request
+  // body, or `*` for mapping all request fields not captured by the path
+  // pattern to the HTTP body, or omitted for not having any HTTP request body.
+  //
+  // NOTE: the referred field must be present at the top-level of the request
+  // message type.
+  string body = 7;
+
+  // Optional. The name of the response field whose value is mapped to the HTTP
+  // response body. When omitted, the entire response message will be used
+  // as the HTTP response body.
+  //
+  // NOTE: The referred field must be present at the top-level of the response
+  // message type.
+  string response_body = 12;
+
+  // Additional HTTP bindings for the selector. Nested bindings must
+  // not contain an `additional_bindings` field themselves (that is,
+  // the nesting may only be one level deep).
+  repeated HttpRule additional_bindings = 11;
+}
+
+// A custom pattern is used for defining custom HTTP verb.
+message CustomHttpPattern {
+  // The name of this custom HTTP verb.
+  string kind = 1;
+
+  // The path matched by this custom verb.
+  string path = 2;
+}

+ 77 - 0
proto/google/api/httpbody.proto

@@ -0,0 +1,77 @@
+// Copyright 2020 Google 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 google.api;
+
+import "google/protobuf/any.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
+option java_multiple_files = true;
+option java_outer_classname = "HttpBodyProto";
+option java_package = "com.google.api";
+option objc_class_prefix = "GAPI";
+
+// 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.
+//
+//
+// 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.
+//       google.api.HttpBody http_body = 2;
+//     }
+//
+//     service ResourceService {
+//       rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
+//       rpc UpdateResource(google.api.HttpBody) returns
+//       (google.protobuf.Empty);
+//     }
+//
+// Example with streaming methods:
+//
+//     service CaldavService {
+//       rpc GetCalendar(stream google.api.HttpBody)
+//         returns (stream google.api.HttpBody);
+//       rpc UpdateCalendar(stream google.api.HttpBody)
+//         returns (stream google.api.HttpBody);
+//     }
+//
+// Use of this type only changes how the request and response bodies are
+// handled, all other features will continue to work unchanged.
+message HttpBody {
+  // The HTTP Content-Type header value specifying the content type of the body.
+  string content_type = 1;
+
+  // The HTTP request/response body as raw binary.
+  bytes data = 2;
+
+  // Application specific response metadata. Must be set in the first response
+  // for streaming APIs.
+  repeated google.protobuf.Any extensions = 3;
+}

+ 7 - 0
proto/kuban/api/annotations.proto

@@ -15,6 +15,8 @@ extend google.protobuf.MethodOptions {
 message Options {
   // 操作记录
   OperationRecord operation_record = 2;
+  //mcp 配置
+  McpOptions mcp_options = 3;
 }
 
 // 操作记录
@@ -22,3 +24,8 @@ message OperationRecord {
   // 接口是否需要记录
   bool enabled = 1;
 }
+
+message McpOptions{
+  //是否生成mcp
+  bool enabled = 1;
+}

+ 672 - 0
proto/openapiv3/OpenAPIv3.proto

@@ -0,0 +1,672 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// 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.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+syntax = "proto3";
+
+package openapi.v3;
+
+import "google/protobuf/any.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "OpenAPIProto";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.openapi_v3";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+option objc_class_prefix = "OAS";
+
+// The Go package name.
+option go_package = "github.com/google/gnostic/openapiv3;openapi_v3";
+
+message AdditionalPropertiesItem {
+  oneof oneof {
+    SchemaOrReference schema_or_reference = 1;
+    bool boolean = 2;
+  }
+}
+
+message Any {
+  google.protobuf.Any value = 1;
+  string yaml = 2;
+}
+
+message AnyOrExpression {
+  oneof oneof {
+    Any any = 1;
+    Expression expression = 2;
+  }
+}
+
+// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
+message Callback {
+  repeated NamedPathItem path = 1;
+  repeated NamedAny specification_extension = 2;
+}
+
+message CallbackOrReference {
+  oneof oneof {
+    Callback callback = 1;
+    Reference reference = 2;
+  }
+}
+
+message CallbacksOrReferences {
+  repeated NamedCallbackOrReference additional_properties = 1;
+}
+
+// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
+message Components {
+  SchemasOrReferences schemas = 1;
+  ResponsesOrReferences responses = 2;
+  ParametersOrReferences parameters = 3;
+  ExamplesOrReferences examples = 4;
+  RequestBodiesOrReferences request_bodies = 5;
+  HeadersOrReferences headers = 6;
+  SecuritySchemesOrReferences security_schemes = 7;
+  LinksOrReferences links = 8;
+  CallbacksOrReferences callbacks = 9;
+  repeated NamedAny specification_extension = 10;
+}
+
+// Contact information for the exposed API.
+message Contact {
+  string name = 1;
+  string url = 2;
+  string email = 3;
+  repeated NamedAny specification_extension = 4;
+}
+
+message DefaultType {
+  oneof oneof {
+    double number = 1;
+    bool boolean = 2;
+    string string = 3;
+  }
+}
+
+// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation.  The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.  When using the discriminator, _inline_ schemas will not be considered.
+message Discriminator {
+  string property_name = 1;
+  Strings mapping = 2;
+  repeated NamedAny specification_extension = 3;
+}
+
+message Document {
+  string openapi = 1;
+  Info info = 2;
+  repeated Server servers = 3;
+  Paths paths = 4;
+  Components components = 5;
+  repeated SecurityRequirement security = 6;
+  repeated Tag tags = 7;
+  ExternalDocs external_docs = 8;
+  repeated NamedAny specification_extension = 9;
+}
+
+// A single encoding definition applied to a single schema property.
+message Encoding {
+  string content_type = 1;
+  HeadersOrReferences headers = 2;
+  string style = 3;
+  bool explode = 4;
+  bool allow_reserved = 5;
+  repeated NamedAny specification_extension = 6;
+}
+
+message Encodings {
+  repeated NamedEncoding additional_properties = 1;
+}
+
+message Example {
+  string summary = 1;
+  string description = 2;
+  Any value = 3;
+  string external_value = 4;
+  repeated NamedAny specification_extension = 5;
+}
+
+message ExampleOrReference {
+  oneof oneof {
+    Example example = 1;
+    Reference reference = 2;
+  }
+}
+
+message ExamplesOrReferences {
+  repeated NamedExampleOrReference additional_properties = 1;
+}
+
+message Expression {
+  repeated NamedAny additional_properties = 1;
+}
+
+// Allows referencing an external resource for extended documentation.
+message ExternalDocs {
+  string description = 1;
+  string url = 2;
+  repeated NamedAny specification_extension = 3;
+}
+
+// The Header Object follows the structure of the Parameter Object with the following changes:  1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).
+message Header {
+  string description = 1;
+  bool required = 2;
+  bool deprecated = 3;
+  bool allow_empty_value = 4;
+  string style = 5;
+  bool explode = 6;
+  bool allow_reserved = 7;
+  SchemaOrReference schema = 8;
+  Any example = 9;
+  ExamplesOrReferences examples = 10;
+  MediaTypes content = 11;
+  repeated NamedAny specification_extension = 12;
+}
+
+message HeaderOrReference {
+  oneof oneof {
+    Header header = 1;
+    Reference reference = 2;
+  }
+}
+
+message HeadersOrReferences {
+  repeated NamedHeaderOrReference additional_properties = 1;
+}
+
+// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
+message Info {
+  string title = 1;
+  string description = 2;
+  string terms_of_service = 3;
+  Contact contact = 4;
+  License license = 5;
+  string version = 6;
+  repeated NamedAny specification_extension = 7;
+  string summary = 8;
+}
+
+message ItemsItem {
+  repeated SchemaOrReference schema_or_reference = 1;
+}
+
+// License information for the exposed API.
+message License {
+  string name = 1;
+  string url = 2;
+  repeated NamedAny specification_extension = 3;
+}
+
+// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.  Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response.  For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
+message Link {
+  string operation_ref = 1;
+  string operation_id = 2;
+  AnyOrExpression parameters = 3;
+  AnyOrExpression request_body = 4;
+  string description = 5;
+  Server server = 6;
+  repeated NamedAny specification_extension = 7;
+}
+
+message LinkOrReference {
+  oneof oneof {
+    Link link = 1;
+    Reference reference = 2;
+  }
+}
+
+message LinksOrReferences {
+  repeated NamedLinkOrReference additional_properties = 1;
+}
+
+// Each Media Type Object provides schema and examples for the media type identified by its key.
+message MediaType {
+  SchemaOrReference schema = 1;
+  Any example = 2;
+  ExamplesOrReferences examples = 3;
+  Encodings encoding = 4;
+  repeated NamedAny specification_extension = 5;
+}
+
+message MediaTypes {
+  repeated NamedMediaType additional_properties = 1;
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+message NamedAny {
+  // Map key
+  string name = 1;
+  // Mapped value
+  Any value = 2;
+}
+
+// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs.
+message NamedCallbackOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  CallbackOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs.
+message NamedEncoding {
+  // Map key
+  string name = 1;
+  // Mapped value
+  Encoding value = 2;
+}
+
+// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs.
+message NamedExampleOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  ExampleOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs.
+message NamedHeaderOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  HeaderOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs.
+message NamedLinkOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  LinkOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs.
+message NamedMediaType {
+  // Map key
+  string name = 1;
+  // Mapped value
+  MediaType value = 2;
+}
+
+// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs.
+message NamedParameterOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  ParameterOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+message NamedPathItem {
+  // Map key
+  string name = 1;
+  // Mapped value
+  PathItem value = 2;
+}
+
+// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs.
+message NamedRequestBodyOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  RequestBodyOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs.
+message NamedResponseOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  ResponseOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs.
+message NamedSchemaOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  SchemaOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs.
+message NamedSecuritySchemeOrReference {
+  // Map key
+  string name = 1;
+  // Mapped value
+  SecuritySchemeOrReference value = 2;
+}
+
+// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs.
+message NamedServerVariable {
+  // Map key
+  string name = 1;
+  // Mapped value
+  ServerVariable value = 2;
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+message NamedString {
+  // Map key
+  string name = 1;
+  // Mapped value
+  string value = 2;
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+message NamedStringArray {
+  // Map key
+  string name = 1;
+  // Mapped value
+  StringArray value = 2;
+}
+
+// Configuration details for a supported OAuth Flow
+message OauthFlow {
+  string authorization_url = 1;
+  string token_url = 2;
+  string refresh_url = 3;
+  Strings scopes = 4;
+  repeated NamedAny specification_extension = 5;
+}
+
+// Allows configuration of the supported OAuth Flows.
+message OauthFlows {
+  OauthFlow implicit = 1;
+  OauthFlow password = 2;
+  OauthFlow client_credentials = 3;
+  OauthFlow authorization_code = 4;
+  repeated NamedAny specification_extension = 5;
+}
+
+message Object {
+  repeated NamedAny additional_properties = 1;
+}
+
+// Describes a single API operation on a path.
+message Operation {
+  repeated string tags = 1;
+  string summary = 2;
+  string description = 3;
+  ExternalDocs external_docs = 4;
+  string operation_id = 5;
+  repeated ParameterOrReference parameters = 6;
+  RequestBodyOrReference request_body = 7;
+  Responses responses = 8;
+  CallbacksOrReferences callbacks = 9;
+  bool deprecated = 10;
+  repeated SecurityRequirement security = 11;
+  repeated Server servers = 12;
+  repeated NamedAny specification_extension = 13;
+}
+
+// Describes a single operation parameter.  A unique parameter is defined by a combination of a name and location.
+message Parameter {
+  string name = 1;
+  string in = 2;
+  string description = 3;
+  bool required = 4;
+  bool deprecated = 5;
+  bool allow_empty_value = 6;
+  string style = 7;
+  bool explode = 8;
+  bool allow_reserved = 9;
+  SchemaOrReference schema = 10;
+  Any example = 11;
+  ExamplesOrReferences examples = 12;
+  MediaTypes content = 13;
+  repeated NamedAny specification_extension = 14;
+}
+
+message ParameterOrReference {
+  oneof oneof {
+    Parameter parameter = 1;
+    Reference reference = 2;
+  }
+}
+
+message ParametersOrReferences {
+  repeated NamedParameterOrReference additional_properties = 1;
+}
+
+// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
+message PathItem {
+  string _ref = 1;
+  string summary = 2;
+  string description = 3;
+  Operation get = 4;
+  Operation put = 5;
+  Operation post = 6;
+  Operation delete = 7;
+  Operation options = 8;
+  Operation head = 9;
+  Operation patch = 10;
+  Operation trace = 11;
+  repeated Server servers = 12;
+  repeated ParameterOrReference parameters = 13;
+  repeated NamedAny specification_extension = 14;
+}
+
+// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL.  The Paths MAY be empty, due to ACL constraints.
+message Paths {
+  repeated NamedPathItem path = 1;
+  repeated NamedAny specification_extension = 2;
+}
+
+message Properties {
+  repeated NamedSchemaOrReference additional_properties = 1;
+}
+
+// A simple object to allow referencing other components in the specification, internally and externally.  The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.   For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
+message Reference {
+  string _ref = 1;
+  string summary = 2;
+  string description = 3;
+}
+
+message RequestBodiesOrReferences {
+  repeated NamedRequestBodyOrReference additional_properties = 1;
+}
+
+// Describes a single request body.
+message RequestBody {
+  string description = 1;
+  MediaTypes content = 2;
+  bool required = 3;
+  repeated NamedAny specification_extension = 4;
+}
+
+message RequestBodyOrReference {
+  oneof oneof {
+    RequestBody request_body = 1;
+    Reference reference = 2;
+  }
+}
+
+// Describes a single response from an API Operation, including design-time, static  `links` to operations based on the response.
+message Response {
+  string description = 1;
+  HeadersOrReferences headers = 2;
+  MediaTypes content = 3;
+  LinksOrReferences links = 4;
+  repeated NamedAny specification_extension = 5;
+}
+
+message ResponseOrReference {
+  oneof oneof {
+    Response response = 1;
+    Reference reference = 2;
+  }
+}
+
+// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.  The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors.  The `default` MAY be used as a default response object for all HTTP codes  that are not covered individually by the specification.  The `Responses Object` MUST contain at least one response code, and it  SHOULD be the response for a successful operation call.
+message Responses {
+  ResponseOrReference default = 1;
+  repeated NamedResponseOrReference response_or_reference = 2;
+  repeated NamedAny specification_extension = 3;
+}
+
+message ResponsesOrReferences {
+  repeated NamedResponseOrReference additional_properties = 1;
+}
+
+// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00.  For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.
+message Schema {
+  bool nullable = 1;
+  Discriminator discriminator = 2;
+  bool read_only = 3;
+  bool write_only = 4;
+  Xml xml = 5;
+  ExternalDocs external_docs = 6;
+  Any example = 7;
+  bool deprecated = 8;
+  string title = 9;
+  double multiple_of = 10;
+  double maximum = 11;
+  bool exclusive_maximum = 12;
+  double minimum = 13;
+  bool exclusive_minimum = 14;
+  int64 max_length = 15;
+  int64 min_length = 16;
+  string pattern = 17;
+  int64 max_items = 18;
+  int64 min_items = 19;
+  bool unique_items = 20;
+  int64 max_properties = 21;
+  int64 min_properties = 22;
+  repeated string required = 23;
+  repeated Any enum = 24;
+  string type = 25;
+  repeated SchemaOrReference all_of = 26;
+  repeated SchemaOrReference one_of = 27;
+  repeated SchemaOrReference any_of = 28;
+  Schema not = 29;
+  ItemsItem items = 30;
+  Properties properties = 31;
+  AdditionalPropertiesItem additional_properties = 32;
+  DefaultType default = 33;
+  string description = 34;
+  string format = 35;
+  repeated NamedAny specification_extension = 36;
+}
+
+message SchemaOrReference {
+  oneof oneof {
+    Schema schema = 1;
+    Reference reference = 2;
+  }
+}
+
+message SchemasOrReferences {
+  repeated NamedSchemaOrReference additional_properties = 1;
+}
+
+// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.  Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.  When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
+message SecurityRequirement {
+  repeated NamedStringArray additional_properties = 1;
+}
+
+// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect.   Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.
+message SecurityScheme {
+  string type = 1;
+  string description = 2;
+  string name = 3;
+  string in = 4;
+  string scheme = 5;
+  string bearer_format = 6;
+  OauthFlows flows = 7;
+  string open_id_connect_url = 8;
+  repeated NamedAny specification_extension = 9;
+}
+
+message SecuritySchemeOrReference {
+  oneof oneof {
+    SecurityScheme security_scheme = 1;
+    Reference reference = 2;
+  }
+}
+
+message SecuritySchemesOrReferences {
+  repeated NamedSecuritySchemeOrReference additional_properties = 1;
+}
+
+// An object representing a Server.
+message Server {
+  string url = 1;
+  string description = 2;
+  ServerVariables variables = 3;
+  repeated NamedAny specification_extension = 4;
+}
+
+// An object representing a Server Variable for server URL template substitution.
+message ServerVariable {
+  repeated string enum = 1;
+  string default = 2;
+  string description = 3;
+  repeated NamedAny specification_extension = 4;
+}
+
+message ServerVariables {
+  repeated NamedServerVariable additional_properties = 1;
+}
+
+// Any property starting with x- is valid.
+message SpecificationExtension {
+  oneof oneof {
+    double number = 1;
+    bool boolean = 2;
+    string string = 3;
+  }
+}
+
+message StringArray {
+  repeated string value = 1;
+}
+
+message Strings {
+  repeated NamedString additional_properties = 1;
+}
+
+// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
+message Tag {
+  string name = 1;
+  string description = 2;
+  ExternalDocs external_docs = 3;
+  repeated NamedAny specification_extension = 4;
+}
+
+// A metadata object that allows for more fine-tuned XML model definitions.  When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
+message Xml {
+  string name = 1;
+  string namespace = 2;
+  string prefix = 3;
+  bool attribute = 4;
+  bool wrapped = 5;
+  repeated NamedAny specification_extension = 6;
+}
+

+ 60 - 0
proto/openapiv3/annotations.proto

@@ -0,0 +1,60 @@
+// Copyright 2022 Google LLC. All Rights Reserved.
+//
+// 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 openapi.v3;
+
+import "openapiv3/OpenAPIv3.proto";
+import "google/protobuf/descriptor.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "AnnotationsProto";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.openapi_v3";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+option objc_class_prefix = "OAS";
+
+// The Go package name.
+option go_package = "github.com/google/gnostic/openapiv3;openapi_v3";
+
+extend google.protobuf.FileOptions {
+  Document document = 1143;
+}
+
+extend google.protobuf.MethodOptions {
+  Operation operation = 1143;
+}
+
+extend google.protobuf.MessageOptions {
+  Schema schema = 1143;
+}
+
+extend google.protobuf.FieldOptions {
+  Schema property = 1143;
+}