From 667b3f94762ee6caaa5b9765db973c21b3e151ee Mon Sep 17 00:00:00 2001 From: Jameel Al-Aziz Date: Sun, 23 Aug 2026 13:03:33 -0700 Subject: [PATCH] Add enum schema annotation Expose OpenAPI schema metadata on protobuf enum types so downstream generators can consume enum-level defaults, examples, and descriptions. --- openapiv3/annotations.pb.go | 72 ++++++++++++++++++++++++------------- openapiv3/annotations.proto | 4 +++ 2 files changed, 52 insertions(+), 24 deletions(-) diff --git a/openapiv3/annotations.pb.go b/openapiv3/annotations.pb.go index f9f1bd2..21f58bb 100644 --- a/openapiv3/annotations.pb.go +++ b/openapiv3/annotations.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.35.1 -// protoc v4.23.4 +// protoc v7.35.1 // source: openapiv3/annotations.proto package openapi_v3 @@ -67,6 +67,14 @@ var file_openapiv3_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "bytes,1143,opt,name=property", Filename: "openapiv3/annotations.proto", }, + { + ExtendedType: (*descriptorpb.EnumOptions)(nil), + ExtensionType: (*Schema)(nil), + Field: 1143, + Name: "openapi.v3.enum_schema", + Tag: "bytes,1143,opt,name=enum_schema", + Filename: "openapiv3/annotations.proto", + }, } // Extension fields to descriptorpb.FileOptions. @@ -93,6 +101,12 @@ var ( E_Property = &file_openapiv3_annotations_proto_extTypes[3] ) +// Extension fields to descriptorpb.EnumOptions. +var ( + // optional openapi.v3.Schema enum_schema = 1143; + E_EnumSchema = &file_openapiv3_annotations_proto_extTypes[4] +) + var File_openapiv3_annotations_proto protoreflect.FileDescriptor var file_openapiv3_annotations_proto_rawDesc = []byte{ @@ -122,12 +136,19 @@ var file_openapiv3_annotations_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf7, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x42, 0x42, 0x0a, 0x0e, 0x6f, - 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, 0x42, 0x10, 0x41, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x3b, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, 0xa2, 0x02, 0x03, 0x4f, 0x41, 0x53, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x3a, 0x52, 0x0a, 0x0b, 0x65, + 0x6e, 0x75, 0x6d, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf7, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x52, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, + 0x61, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, + 0x33, 0x42, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, + 0x2d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, + 0x33, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, 0xa2, 0x02, 0x03, 0x4f, + 0x41, 0x53, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_openapiv3_annotations_proto_goTypes = []any{ @@ -135,24 +156,27 @@ var file_openapiv3_annotations_proto_goTypes = []any{ (*descriptorpb.MethodOptions)(nil), // 1: google.protobuf.MethodOptions (*descriptorpb.MessageOptions)(nil), // 2: google.protobuf.MessageOptions (*descriptorpb.FieldOptions)(nil), // 3: google.protobuf.FieldOptions - (*Document)(nil), // 4: openapi.v3.Document - (*Operation)(nil), // 5: openapi.v3.Operation - (*Schema)(nil), // 6: openapi.v3.Schema + (*descriptorpb.EnumOptions)(nil), // 4: google.protobuf.EnumOptions + (*Document)(nil), // 5: openapi.v3.Document + (*Operation)(nil), // 6: openapi.v3.Operation + (*Schema)(nil), // 7: openapi.v3.Schema } var file_openapiv3_annotations_proto_depIdxs = []int32{ - 0, // 0: openapi.v3.document:extendee -> google.protobuf.FileOptions - 1, // 1: openapi.v3.operation:extendee -> google.protobuf.MethodOptions - 2, // 2: openapi.v3.schema:extendee -> google.protobuf.MessageOptions - 3, // 3: openapi.v3.property:extendee -> google.protobuf.FieldOptions - 4, // 4: openapi.v3.document:type_name -> openapi.v3.Document - 5, // 5: openapi.v3.operation:type_name -> openapi.v3.Operation - 6, // 6: openapi.v3.schema:type_name -> openapi.v3.Schema - 6, // 7: openapi.v3.property:type_name -> openapi.v3.Schema - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 4, // [4:8] is the sub-list for extension type_name - 0, // [0:4] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: openapi.v3.document:extendee -> google.protobuf.FileOptions + 1, // 1: openapi.v3.operation:extendee -> google.protobuf.MethodOptions + 2, // 2: openapi.v3.schema:extendee -> google.protobuf.MessageOptions + 3, // 3: openapi.v3.property:extendee -> google.protobuf.FieldOptions + 4, // 4: openapi.v3.enum_schema:extendee -> google.protobuf.EnumOptions + 5, // 5: openapi.v3.document:type_name -> openapi.v3.Document + 6, // 6: openapi.v3.operation:type_name -> openapi.v3.Operation + 7, // 7: openapi.v3.schema:type_name -> openapi.v3.Schema + 7, // 8: openapi.v3.property:type_name -> openapi.v3.Schema + 7, // 9: openapi.v3.enum_schema:type_name -> openapi.v3.Schema + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 5, // [5:10] is the sub-list for extension type_name + 0, // [0:5] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_openapiv3_annotations_proto_init() } @@ -168,7 +192,7 @@ func file_openapiv3_annotations_proto_init() { RawDescriptor: file_openapiv3_annotations_proto_rawDesc, NumEnums: 0, NumMessages: 0, - NumExtensions: 4, + NumExtensions: 5, NumServices: 0, }, GoTypes: file_openapiv3_annotations_proto_goTypes, diff --git a/openapiv3/annotations.proto b/openapiv3/annotations.proto index 895b456..1697a10 100644 --- a/openapiv3/annotations.proto +++ b/openapiv3/annotations.proto @@ -54,3 +54,7 @@ extend google.protobuf.MessageOptions { extend google.protobuf.FieldOptions { Schema property = 1143; } + +extend google.protobuf.EnumOptions { + Schema enum_schema = 1143; +}