diff --git a/packages/protobuf-test/extra/option-usage.proto b/packages/protobuf-test/extra/option-usage.proto new file mode 100644 index 000000000..3c6f9ff39 --- /dev/null +++ b/packages/protobuf-test/extra/option-usage.proto @@ -0,0 +1,61 @@ +// Copyright 2021-2024 Buf Technologies, 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 spec; + +import "extra/options.proto"; + +option (spec.file_option_retention_unknown) = "file option retention unknown"; +option (spec.file_option_retention_runtime) = "file option retention runtime"; +option (spec.file_option_retention_source) = "file option retention source"; + +message MessageWithOptions { + option (spec.message_option_retention_unknown) = "message option retention unknown"; + option (spec.message_option_retention_runtime) = "message option retention runtime"; + option (spec.message_option_retention_source) = "message option retention source"; + int32 field = 1 [ + (spec.field_option_retention_unknown) = "field option retention unknown", + (spec.field_option_retention_runtime) = "field option retention runtime", + (spec.field_option_retention_source) = "field option retention source" + ]; + oneof kind { + option (spec.oneof_option_retention_unknown) = "oneof option retention unknown"; + option (spec.oneof_option_retention_runtime) = "oneof option retention runtime"; + option (spec.oneof_option_retention_source) = "oneof option retention source"; + int32 oneof_field = 2; + } +} + +enum EnumWithOptions { + option (spec.enum_option_retention_unknown) = "enum option retention unknown"; + option (spec.enum_option_retention_runtime) = "enum option retention runtime"; + option (spec.enum_option_retention_source) = "enum option retention source"; + ENUM_WITH_OPTIONS_UNSPECIFIED = 0 [ + (spec.enum_value_option_retention_unknown) = "enum value option retention unknown", + (spec.enum_value_option_retention_runtime) = "enum value option retention runtime", + (spec.enum_value_option_retention_source) = "enum value option retention source" + ]; +} + +service ServiceWithOptions { + option (spec.service_option_retention_unknown) = "service option retention unknown"; + option (spec.service_option_retention_runtime) = "service option retention runtime"; + option (spec.service_option_retention_source) = "service option retention source"; + rpc Foo (MessageWithOptions) returns (MessageWithOptions) { + option (spec.method_option_retention_unknown) = "method option retention unknown"; + option (spec.method_option_retention_runtime) = "method option retention runtime"; + option (spec.method_option_retention_source) = "method option retention source"; + } +} diff --git a/packages/protobuf-test/extra/options.proto b/packages/protobuf-test/extra/options.proto new file mode 100644 index 000000000..eba9c959e --- /dev/null +++ b/packages/protobuf-test/extra/options.proto @@ -0,0 +1,66 @@ +// Copyright 2021-2024 Buf Technologies, 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 spec; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + optional string file_option_retention_unknown = 70101; + optional string file_option_retention_runtime = 70102 [retention = RETENTION_RUNTIME]; + optional string file_option_retention_source = 70103 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.MessageOptions { + optional string message_option_retention_unknown = 70201; + optional string message_option_retention_runtime = 70202 [retention = RETENTION_RUNTIME]; + optional string message_option_retention_source = 70203 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.FieldOptions { + optional string field_option_retention_unknown = 70301; + optional string field_option_retention_runtime = 70302 [retention = RETENTION_RUNTIME]; + optional string field_option_retention_source = 70303 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.OneofOptions { + optional string oneof_option_retention_unknown = 70401; + optional string oneof_option_retention_runtime = 70402 [retention = RETENTION_RUNTIME]; + optional string oneof_option_retention_source = 70403 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.EnumOptions { + optional string enum_option_retention_unknown = 70501; + optional string enum_option_retention_runtime = 70502 [retention = RETENTION_RUNTIME]; + optional string enum_option_retention_source = 70503 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.EnumValueOptions { + optional string enum_value_option_retention_unknown = 70601; + optional string enum_value_option_retention_runtime = 70602 [retention = RETENTION_RUNTIME]; + optional string enum_value_option_retention_source = 70603 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.ServiceOptions { + optional string service_option_retention_unknown = 70701; + optional string service_option_retention_runtime = 70702 [retention = RETENTION_RUNTIME]; + optional string service_option_retention_source = 70703 [retention = RETENTION_SOURCE]; +} + +extend google.protobuf.MethodOptions { + optional string method_option_retention_unknown = 70801; + optional string method_option_retention_runtime = 70802 [retention = RETENTION_RUNTIME]; + optional string method_option_retention_source = 70803 [retention = RETENTION_SOURCE]; +} diff --git a/packages/protobuf-test/src/codegenv1/boot.test.ts b/packages/protobuf-test/src/codegenv1/boot.test.ts index 38a42d896..aba9ce6d8 100644 --- a/packages/protobuf-test/src/codegenv1/boot.test.ts +++ b/packages/protobuf-test/src/codegenv1/boot.test.ts @@ -35,18 +35,12 @@ import { createFileDescriptorProtoBoot, embedFileDesc, } from "@bufbuild/protobuf/codegenv1"; -import { createFileRegistry } from "@bufbuild/protobuf/reflect"; import { boot } from "@bufbuild/protobuf/codegenv1"; describe("boot()", () => { test("hydrates google/protobuf/descriptor.proto", async () => { const fileDescriptorProto = await compileGoogleProtobufDescriptorProto(); - const fileDesc = createFileRegistry( - fileDescriptorProto, - () => undefined, - ).getFile(fileDescriptorProto.name); - assert(fileDesc); - const embedded = embedFileDesc(fileDesc); + const embedded = embedFileDesc(fileDescriptorProto); assert(embedded.bootable); const bootedFileDesc = boot(embedded.boot()); diff --git a/packages/protobuf-test/src/codegenv1/embed.test.ts b/packages/protobuf-test/src/codegenv1/embed.test.ts index 786368b2d..ad4a8c23a 100644 --- a/packages/protobuf-test/src/codegenv1/embed.test.ts +++ b/packages/protobuf-test/src/codegenv1/embed.test.ts @@ -26,7 +26,7 @@ describe("embedFileDesc()", () => { int32 int32_field = 1; } `); - const embedded = embedFileDesc(file); + const embedded = embedFileDesc(file.proto); expect(embedded.bootable).toBe(false); expect(typeof embedded.base64()).toBe("string"); }); @@ -41,7 +41,7 @@ describe("embedFileDesc()", () => { ).getFile("google/protobuf/descriptor.proto"); assert(file); - const embedded = embedFileDesc(file); + const embedded = embedFileDesc(file.proto); expect(embedded).toBeDefined(); expect(embedded.bootable).toBe(true); if (embedded.bootable) { diff --git a/packages/protobuf-test/src/codegenv1/hydrate.test.ts b/packages/protobuf-test/src/codegenv1/hydrate.test.ts index d3ddc5c2b..80d712fee 100644 --- a/packages/protobuf-test/src/codegenv1/hydrate.test.ts +++ b/packages/protobuf-test/src/codegenv1/hydrate.test.ts @@ -24,7 +24,7 @@ describe("fileDesc()", () => { int32 int32_field = 1; } `); - const hydrated = fileDesc(embedFileDesc(file).base64()); + const hydrated = fileDesc(embedFileDesc(file.proto).base64()); const field = hydrated.messages[0].fields[0]; expect(field.jsonName).toBe("int32Field"); expect(field.proto.jsonName).toBe("int32Field"); @@ -37,7 +37,7 @@ describe("fileDesc()", () => { int32 int32_field = 1 [json_name="foo"]; } `); - const hydrated = fileDesc(embedFileDesc(file).base64()); + const hydrated = fileDesc(embedFileDesc(file.proto).base64()); const field = hydrated.messages[0].fields[0]; expect(field.jsonName).toBe("foo"); expect(field.proto.jsonName).toBe("foo"); diff --git a/packages/protobuf-test/src/gen/js/extra/option-usage_pb.d.ts b/packages/protobuf-test/src/gen/js/extra/option-usage_pb.d.ts new file mode 100644 index 000000000..181669bb5 --- /dev/null +++ b/packages/protobuf-test/src/gen/js/extra/option-usage_pb.d.ts @@ -0,0 +1,83 @@ +// Copyright 2021-2024 Buf Technologies, 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. + +// @generated by protoc-gen-es v2.0.0-alpha.1 with parameter "ts_nocheck=false,target=js+dts" +// @generated from file extra/option-usage.proto (package spec, syntax proto3) +/* eslint-disable */ + +import type { GenDescEnum, GenDescFile, GenDescMessage, GenDescService } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file extra/option-usage.proto. + */ +export declare const fileDesc_extra_option_usage: GenDescFile; + +/** + * @generated from message spec.MessageWithOptions + */ +export declare type MessageWithOptions = Message<"spec.MessageWithOptions"> & { + /** + * @generated from field: int32 field = 1; + */ + field: number; + + /** + * @generated from oneof spec.MessageWithOptions.kind + */ + kind: { + /** + * @generated from field: int32 oneof_field = 2; + */ + value: number; + case: "oneofField"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message spec.MessageWithOptions. + * Use `create(MessageWithOptionsDesc)` to create a new message. + */ +export declare const MessageWithOptionsDesc: GenDescMessage; + +/** + * @generated from enum spec.EnumWithOptions + */ +export enum EnumWithOptions { + /** + * @generated from enum value: ENUM_WITH_OPTIONS_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, +} + +/** + * Describes the enum spec.EnumWithOptions. + */ +export declare const EnumWithOptionsDesc: GenDescEnum; + +/** + * @generated from service spec.ServiceWithOptions + */ +export declare const ServiceWithOptions: GenDescService<{ + /** + * @generated from rpc spec.ServiceWithOptions.Foo + */ + foo: { + kind: "unary"; + I: MessageWithOptions; + O: MessageWithOptions; + }, +} +>; + diff --git a/packages/protobuf-test/src/gen/js/extra/option-usage_pb.js b/packages/protobuf-test/src/gen/js/extra/option-usage_pb.js new file mode 100644 index 000000000..28127febc --- /dev/null +++ b/packages/protobuf-test/src/gen/js/extra/option-usage_pb.js @@ -0,0 +1,52 @@ +// Copyright 2021-2024 Buf Technologies, 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. + +// @generated by protoc-gen-es v2.0.0-alpha.1 with parameter "ts_nocheck=false,target=js+dts" +// @generated from file extra/option-usage.proto (package spec, syntax proto3) +/* eslint-disable */ + +import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc_extra_options } from "./options_pb.js"; + +/** + * Describes the file extra/option-usage.proto. + */ +export const fileDesc_extra_option_usage = /*@__PURE__*/ + fileDesc("ChhleHRyYS9vcHRpb24tdXNhZ2UucHJvdG8SBHNwZWMimAIKEk1lc3NhZ2VXaXRoT3B0aW9ucxJTCgVmaWVsZBgBIAEoBUJE6qkiHmZpZWxkIG9wdGlvbiByZXRlbnRpb24gdW5rbm93bvKpIh5maWVsZCBvcHRpb24gcmV0ZW50aW9uIHJ1bnRpbWUSFQoLb25lb2ZfZmllbGQYAiABKAVIADpIyqMiIG1lc3NhZ2Ugb3B0aW9uIHJldGVudGlvbiB1bmtub3du0qMiIG1lc3NhZ2Ugb3B0aW9uIHJldGVudGlvbiBydW50aW1lQkwKBGtpbmQSRIqwIh5vbmVvZiBvcHRpb24gcmV0ZW50aW9uIHVua25vd26SsCIeb25lb2Ygb3B0aW9uIHJldGVudGlvbiBydW50aW1lKsgBCg9FbnVtV2l0aE9wdGlvbnMScQodRU5VTV9XSVRIX09QVElPTlNfVU5TUEVDSUZJRUQQABpOyrwiI2VudW0gdmFsdWUgb3B0aW9uIHJldGVudGlvbiB1bmtub3du0rwiI2VudW0gdmFsdWUgb3B0aW9uIHJldGVudGlvbiBydW50aW1lGkKqtiIdZW51bSBvcHRpb24gcmV0ZW50aW9uIHVua25vd26ytiIdZW51bSBvcHRpb24gcmV0ZW50aW9uIHJ1bnRpbWUy4gEKElNlcnZpY2VXaXRoT3B0aW9ucxKBAQoDRm9vEhguc3BlYy5NZXNzYWdlV2l0aE9wdGlvbnMaGC5zcGVjLk1lc3NhZ2VXaXRoT3B0aW9ucyJGiskiH21ldGhvZCBvcHRpb24gcmV0ZW50aW9uIHVua25vd26SySIfbWV0aG9kIG9wdGlvbiByZXRlbnRpb24gcnVudGltZRpI6sIiIHNlcnZpY2Ugb3B0aW9uIHJldGVudGlvbiB1bmtub3du8sIiIHNlcnZpY2Ugb3B0aW9uIHJldGVudGlvbiBydW50aW1lQkKqnSIdZmlsZSBvcHRpb24gcmV0ZW50aW9uIHVua25vd26ynSIdZmlsZSBvcHRpb24gcmV0ZW50aW9uIHJ1bnRpbWViBnByb3RvMw", [fileDesc_extra_options]); + +/** + * Describes the message spec.MessageWithOptions. + * Use `create(MessageWithOptionsDesc)` to create a new message. + */ +export const MessageWithOptionsDesc = /*@__PURE__*/ + messageDesc(fileDesc_extra_option_usage, 0); + +/** + * Describes the enum spec.EnumWithOptions. + */ +export const EnumWithOptionsDesc = /*@__PURE__*/ + enumDesc(fileDesc_extra_option_usage, 0); + +/** + * @generated from enum spec.EnumWithOptions + */ +export const EnumWithOptions = /*@__PURE__*/ + tsEnum(EnumWithOptionsDesc); + +/** + * @generated from service spec.ServiceWithOptions + */ +export const ServiceWithOptions = /*@__PURE__*/ + serviceDesc(fileDesc_extra_option_usage, 0); + diff --git a/packages/protobuf-test/src/gen/js/extra/options_pb.d.ts b/packages/protobuf-test/src/gen/js/extra/options_pb.d.ts new file mode 100644 index 000000000..a1c7fa6b6 --- /dev/null +++ b/packages/protobuf-test/src/gen/js/extra/options_pb.d.ts @@ -0,0 +1,146 @@ +// Copyright 2021-2024 Buf Technologies, 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. + +// @generated by protoc-gen-es v2.0.0-alpha.1 with parameter "ts_nocheck=false,target=js+dts" +// @generated from file extra/options.proto (package spec, syntax proto3) +/* eslint-disable */ + +import type { GenDescExtension, GenDescFile } from "@bufbuild/protobuf/codegenv1"; +import type { EnumOptions, EnumValueOptions, FieldOptions, FileOptions, MessageOptions, MethodOptions, OneofOptions, ServiceOptions } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file extra/options.proto. + */ +export declare const fileDesc_extra_options: GenDescFile; + +/** + * @generated from extension: optional string file_option_retention_unknown = 70101; + */ +export declare const file_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string file_option_retention_runtime = 70102; + */ +export declare const file_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string file_option_retention_source = 70103; + */ +export declare const file_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string message_option_retention_unknown = 70201; + */ +export declare const message_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string message_option_retention_runtime = 70202; + */ +export declare const message_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string message_option_retention_source = 70203; + */ +export declare const message_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string field_option_retention_unknown = 70301; + */ +export declare const field_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string field_option_retention_runtime = 70302; + */ +export declare const field_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string field_option_retention_source = 70303; + */ +export declare const field_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string oneof_option_retention_unknown = 70401; + */ +export declare const oneof_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string oneof_option_retention_runtime = 70402; + */ +export declare const oneof_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string oneof_option_retention_source = 70403; + */ +export declare const oneof_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string enum_option_retention_unknown = 70501; + */ +export declare const enum_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string enum_option_retention_runtime = 70502; + */ +export declare const enum_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string enum_option_retention_source = 70503; + */ +export declare const enum_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string enum_value_option_retention_unknown = 70601; + */ +export declare const enum_value_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string enum_value_option_retention_runtime = 70602; + */ +export declare const enum_value_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string enum_value_option_retention_source = 70603; + */ +export declare const enum_value_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string service_option_retention_unknown = 70701; + */ +export declare const service_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string service_option_retention_runtime = 70702; + */ +export declare const service_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string service_option_retention_source = 70703; + */ +export declare const service_option_retention_source: GenDescExtension; + +/** + * @generated from extension: optional string method_option_retention_unknown = 70801; + */ +export declare const method_option_retention_unknown: GenDescExtension; + +/** + * @generated from extension: optional string method_option_retention_runtime = 70802; + */ +export declare const method_option_retention_runtime: GenDescExtension; + +/** + * @generated from extension: optional string method_option_retention_source = 70803; + */ +export declare const method_option_retention_source: GenDescExtension; + diff --git a/packages/protobuf-test/src/gen/js/extra/options_pb.js b/packages/protobuf-test/src/gen/js/extra/options_pb.js new file mode 100644 index 000000000..47b4a603c --- /dev/null +++ b/packages/protobuf-test/src/gen/js/extra/options_pb.js @@ -0,0 +1,171 @@ +// Copyright 2021-2024 Buf Technologies, 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. + +// @generated by protoc-gen-es v2.0.0-alpha.1 with parameter "ts_nocheck=false,target=js+dts" +// @generated from file extra/options.proto (package spec, syntax proto3) +/* eslint-disable */ + +import { extDesc, fileDesc } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file extra/options.proto. + */ +export const fileDesc_extra_options = /*@__PURE__*/ + fileDesc("ChNleHRyYS9vcHRpb25zLnByb3RvEgRzcGVjOmQKHWZpbGVfb3B0aW9uX3JldGVudGlvbl91bmtub3duEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGNWjBCABKAlSGmZpbGVPcHRpb25SZXRlbnRpb25Vbmtub3duiAEBOmkKHWZpbGVfb3B0aW9uX3JldGVudGlvbl9ydW50aW1lEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGNajBCABKAlCA4gBAVIaZmlsZU9wdGlvblJldGVudGlvblJ1bnRpbWWIAQE6ZwocZmlsZV9vcHRpb25fcmV0ZW50aW9uX3NvdXJjZRIcLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxjXowQgASgJQgOIAQJSGWZpbGVPcHRpb25SZXRlbnRpb25Tb3VyY2WIAQE6bQogbWVzc2FnZV9vcHRpb25fcmV0ZW50aW9uX3Vua25vd24SHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYuaQEIAEoCVIdbWVzc2FnZU9wdGlvblJldGVudGlvblVua25vd26IAQE6cgogbWVzc2FnZV9vcHRpb25fcmV0ZW50aW9uX3J1bnRpbWUSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYuqQEIAEoCUIDiAEBUh1tZXNzYWdlT3B0aW9uUmV0ZW50aW9uUnVudGltZYgBATpwCh9tZXNzYWdlX29wdGlvbl9yZXRlbnRpb25fc291cmNlEh8uZ29vZ2x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fLmdvb2dsZS5wcm90b2J1Zi5TZXJ2aWNlT3B0aW9ucxivqAQgASgJQgOIAQJSHHNlcnZpY2VPcHRpb25SZXRlbnRpb25Tb3VyY2WIAQE6agofbWV0aG9kX29wdGlvbl9yZXRlbnRpb25fdW5rbm93bhIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGJGpBCABKAlSHG1ldGhvZE9wdGlvblJldGVudGlvblVua25vd26IAQE6bwofbWV0aG9kX29wdGlvbl9yZXRlbnRpb25fcnVudGltZRIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGJKpBCABKAlCA4gBAVIcbWV0aG9kT3B0aW9uUmV0ZW50aW9uUnVudGltZYgBATptCh5tZXRob2Rfb3B0aW9uX3JldGVudGlvbl9zb3VyY2USHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxiTqQQgASgJQgOIAQJSG21ldGhvZE9wdGlvblJldGVudGlvblNvdXJjZYgBAWIGcHJvdG8z", [fileDesc_google_protobuf_descriptor]); + +/** + * @generated from extension: optional string file_option_retention_unknown = 70101; + */ +export const file_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 0); + +/** + * @generated from extension: optional string file_option_retention_runtime = 70102; + */ +export const file_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 1); + +/** + * @generated from extension: optional string file_option_retention_source = 70103; + */ +export const file_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 2); + +/** + * @generated from extension: optional string message_option_retention_unknown = 70201; + */ +export const message_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 3); + +/** + * @generated from extension: optional string message_option_retention_runtime = 70202; + */ +export const message_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 4); + +/** + * @generated from extension: optional string message_option_retention_source = 70203; + */ +export const message_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 5); + +/** + * @generated from extension: optional string field_option_retention_unknown = 70301; + */ +export const field_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 6); + +/** + * @generated from extension: optional string field_option_retention_runtime = 70302; + */ +export const field_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 7); + +/** + * @generated from extension: optional string field_option_retention_source = 70303; + */ +export const field_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 8); + +/** + * @generated from extension: optional string oneof_option_retention_unknown = 70401; + */ +export const oneof_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 9); + +/** + * @generated from extension: optional string oneof_option_retention_runtime = 70402; + */ +export const oneof_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 10); + +/** + * @generated from extension: optional string oneof_option_retention_source = 70403; + */ +export const oneof_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 11); + +/** + * @generated from extension: optional string enum_option_retention_unknown = 70501; + */ +export const enum_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 12); + +/** + * @generated from extension: optional string enum_option_retention_runtime = 70502; + */ +export const enum_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 13); + +/** + * @generated from extension: optional string enum_option_retention_source = 70503; + */ +export const enum_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 14); + +/** + * @generated from extension: optional string enum_value_option_retention_unknown = 70601; + */ +export const enum_value_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 15); + +/** + * @generated from extension: optional string enum_value_option_retention_runtime = 70602; + */ +export const enum_value_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 16); + +/** + * @generated from extension: optional string enum_value_option_retention_source = 70603; + */ +export const enum_value_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 17); + +/** + * @generated from extension: optional string service_option_retention_unknown = 70701; + */ +export const service_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 18); + +/** + * @generated from extension: optional string service_option_retention_runtime = 70702; + */ +export const service_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 19); + +/** + * @generated from extension: optional string service_option_retention_source = 70703; + */ +export const service_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 20); + +/** + * @generated from extension: optional string method_option_retention_unknown = 70801; + */ +export const method_option_retention_unknown = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 21); + +/** + * @generated from extension: optional string method_option_retention_runtime = 70802; + */ +export const method_option_retention_runtime = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 22); + +/** + * @generated from extension: optional string method_option_retention_source = 70803; + */ +export const method_option_retention_source = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 23); + diff --git a/packages/protobuf-test/src/gen/ts/extra/option-usage_pb.ts b/packages/protobuf-test/src/gen/ts/extra/option-usage_pb.ts new file mode 100644 index 000000000..e2decc8ef --- /dev/null +++ b/packages/protobuf-test/src/gen/ts/extra/option-usage_pb.ts @@ -0,0 +1,89 @@ +// Copyright 2021-2024 Buf Technologies, 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. + +// @generated by protoc-gen-es v2.0.0-alpha.1 with parameter "ts_nocheck=false,target=ts" +// @generated from file extra/option-usage.proto (package spec, syntax proto3) +/* eslint-disable */ + +import type { GenDescEnum, GenDescFile, GenDescMessage, GenDescService } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc_extra_options } from "./options_pb.js"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file extra/option-usage.proto. + */ +export const fileDesc_extra_option_usage: GenDescFile = /*@__PURE__*/ + fileDesc("ChhleHRyYS9vcHRpb24tdXNhZ2UucHJvdG8SBHNwZWMimAIKEk1lc3NhZ2VXaXRoT3B0aW9ucxJTCgVmaWVsZBgBIAEoBUJE6qkiHmZpZWxkIG9wdGlvbiByZXRlbnRpb24gdW5rbm93bvKpIh5maWVsZCBvcHRpb24gcmV0ZW50aW9uIHJ1bnRpbWUSFQoLb25lb2ZfZmllbGQYAiABKAVIADpIyqMiIG1lc3NhZ2Ugb3B0aW9uIHJldGVudGlvbiB1bmtub3du0qMiIG1lc3NhZ2Ugb3B0aW9uIHJldGVudGlvbiBydW50aW1lQkwKBGtpbmQSRIqwIh5vbmVvZiBvcHRpb24gcmV0ZW50aW9uIHVua25vd26SsCIeb25lb2Ygb3B0aW9uIHJldGVudGlvbiBydW50aW1lKsgBCg9FbnVtV2l0aE9wdGlvbnMScQodRU5VTV9XSVRIX09QVElPTlNfVU5TUEVDSUZJRUQQABpOyrwiI2VudW0gdmFsdWUgb3B0aW9uIHJldGVudGlvbiB1bmtub3du0rwiI2VudW0gdmFsdWUgb3B0aW9uIHJldGVudGlvbiBydW50aW1lGkKqtiIdZW51bSBvcHRpb24gcmV0ZW50aW9uIHVua25vd26ytiIdZW51bSBvcHRpb24gcmV0ZW50aW9uIHJ1bnRpbWUy4gEKElNlcnZpY2VXaXRoT3B0aW9ucxKBAQoDRm9vEhguc3BlYy5NZXNzYWdlV2l0aE9wdGlvbnMaGC5zcGVjLk1lc3NhZ2VXaXRoT3B0aW9ucyJGiskiH21ldGhvZCBvcHRpb24gcmV0ZW50aW9uIHVua25vd26SySIfbWV0aG9kIG9wdGlvbiByZXRlbnRpb24gcnVudGltZRpI6sIiIHNlcnZpY2Ugb3B0aW9uIHJldGVudGlvbiB1bmtub3du8sIiIHNlcnZpY2Ugb3B0aW9uIHJldGVudGlvbiBydW50aW1lQkKqnSIdZmlsZSBvcHRpb24gcmV0ZW50aW9uIHVua25vd26ynSIdZmlsZSBvcHRpb24gcmV0ZW50aW9uIHJ1bnRpbWViBnByb3RvMw", [fileDesc_extra_options]); + +/** + * @generated from message spec.MessageWithOptions + */ +export type MessageWithOptions = Message<"spec.MessageWithOptions"> & { + /** + * @generated from field: int32 field = 1; + */ + field: number; + + /** + * @generated from oneof spec.MessageWithOptions.kind + */ + kind: { + /** + * @generated from field: int32 oneof_field = 2; + */ + value: number; + case: "oneofField"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message spec.MessageWithOptions. + * Use `create(MessageWithOptionsDesc)` to create a new message. + */ +export const MessageWithOptionsDesc: GenDescMessage = /*@__PURE__*/ + messageDesc(fileDesc_extra_option_usage, 0); + +/** + * @generated from enum spec.EnumWithOptions + */ +export enum EnumWithOptions { + /** + * @generated from enum value: ENUM_WITH_OPTIONS_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, +} + +/** + * Describes the enum spec.EnumWithOptions. + */ +export const EnumWithOptionsDesc: GenDescEnum = /*@__PURE__*/ + enumDesc(fileDesc_extra_option_usage, 0); + +/** + * @generated from service spec.ServiceWithOptions + */ +export const ServiceWithOptions: GenDescService<{ + /** + * @generated from rpc spec.ServiceWithOptions.Foo + */ + foo: { + kind: "unary"; + I: MessageWithOptions; + O: MessageWithOptions; + }, +} +> = /*@__PURE__*/ + serviceDesc(fileDesc_extra_option_usage, 0); + diff --git a/packages/protobuf-test/src/gen/ts/extra/options_pb.ts b/packages/protobuf-test/src/gen/ts/extra/options_pb.ts new file mode 100644 index 000000000..f32ff835f --- /dev/null +++ b/packages/protobuf-test/src/gen/ts/extra/options_pb.ts @@ -0,0 +1,173 @@ +// Copyright 2021-2024 Buf Technologies, 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. + +// @generated by protoc-gen-es v2.0.0-alpha.1 with parameter "ts_nocheck=false,target=ts" +// @generated from file extra/options.proto (package spec, syntax proto3) +/* eslint-disable */ + +import type { GenDescExtension, GenDescFile } from "@bufbuild/protobuf/codegenv1"; +import { extDesc, fileDesc } from "@bufbuild/protobuf/codegenv1"; +import type { EnumOptions, EnumValueOptions, FieldOptions, FileOptions, MessageOptions, MethodOptions, OneofOptions, ServiceOptions } from "@bufbuild/protobuf/wkt"; +import { fileDesc_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file extra/options.proto. + */ +export const fileDesc_extra_options: GenDescFile = /*@__PURE__*/ + fileDesc("ChNleHRyYS9vcHRpb25zLnByb3RvEgRzcGVjOmQKHWZpbGVfb3B0aW9uX3JldGVudGlvbl91bmtub3duEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGNWjBCABKAlSGmZpbGVPcHRpb25SZXRlbnRpb25Vbmtub3duiAEBOmkKHWZpbGVfb3B0aW9uX3JldGVudGlvbl9ydW50aW1lEhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGNajBCABKAlCA4gBAVIaZmlsZU9wdGlvblJldGVudGlvblJ1bnRpbWWIAQE6ZwocZmlsZV9vcHRpb25fcmV0ZW50aW9uX3NvdXJjZRIcLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxjXowQgASgJQgOIAQJSGWZpbGVPcHRpb25SZXRlbnRpb25Tb3VyY2WIAQE6bQogbWVzc2FnZV9vcHRpb25fcmV0ZW50aW9uX3Vua25vd24SHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYuaQEIAEoCVIdbWVzc2FnZU9wdGlvblJldGVudGlvblVua25vd26IAQE6cgogbWVzc2FnZV9vcHRpb25fcmV0ZW50aW9uX3J1bnRpbWUSHy5nb29nbGUucHJvdG9idWYuTWVzc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b3RvYnVmLlNlcnZpY2VPcHRpb25zGK6oBCABKAlCA4gBAVIdc2VydmljZU9wdGlvblJldGVudGlvblJ1bnRpbWWIAQE6cAofc2VydmljZV9vcHRpb25fcmV0ZW50aW9uX3NvdXJjZRIfLmdvb2dsZS5wcm90b2J1Zi5TZXJ2aWNlT3B0aW9ucxivqAQgASgJQgOIAQJSHHNlcnZpY2VPcHRpb25SZXRlbnRpb25Tb3VyY2WIAQE6agofbWV0aG9kX29wdGlvbl9yZXRlbnRpb25fdW5rbm93bhIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGJGpBCABKAlSHG1ldGhvZE9wdGlvblJldGVudGlvblVua25vd26IAQE6bwofbWV0aG9kX29wdGlvbl9yZXRlbnRpb25fcnVudGltZRIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGJKpBCABKAlCA4gBAVIcbWV0aG9kT3B0aW9uUmV0ZW50aW9uUnVudGltZYgBATptCh5tZXRob2Rfb3B0aW9uX3JldGVudGlvbl9zb3VyY2USHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxiTqQQgASgJQgOIAQJSG21ldGhvZE9wdGlvblJldGVudGlvblNvdXJjZYgBAWIGcHJvdG8z", [fileDesc_google_protobuf_descriptor]); + +/** + * @generated from extension: optional string file_option_retention_unknown = 70101; + */ +export const file_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 0); + +/** + * @generated from extension: optional string file_option_retention_runtime = 70102; + */ +export const file_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 1); + +/** + * @generated from extension: optional string file_option_retention_source = 70103; + */ +export const file_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 2); + +/** + * @generated from extension: optional string message_option_retention_unknown = 70201; + */ +export const message_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 3); + +/** + * @generated from extension: optional string message_option_retention_runtime = 70202; + */ +export const message_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 4); + +/** + * @generated from extension: optional string message_option_retention_source = 70203; + */ +export const message_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 5); + +/** + * @generated from extension: optional string field_option_retention_unknown = 70301; + */ +export const field_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 6); + +/** + * @generated from extension: optional string field_option_retention_runtime = 70302; + */ +export const field_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 7); + +/** + * @generated from extension: optional string field_option_retention_source = 70303; + */ +export const field_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 8); + +/** + * @generated from extension: optional string oneof_option_retention_unknown = 70401; + */ +export const oneof_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 9); + +/** + * @generated from extension: optional string oneof_option_retention_runtime = 70402; + */ +export const oneof_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 10); + +/** + * @generated from extension: optional string oneof_option_retention_source = 70403; + */ +export const oneof_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 11); + +/** + * @generated from extension: optional string enum_option_retention_unknown = 70501; + */ +export const enum_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 12); + +/** + * @generated from extension: optional string enum_option_retention_runtime = 70502; + */ +export const enum_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 13); + +/** + * @generated from extension: optional string enum_option_retention_source = 70503; + */ +export const enum_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 14); + +/** + * @generated from extension: optional string enum_value_option_retention_unknown = 70601; + */ +export const enum_value_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 15); + +/** + * @generated from extension: optional string enum_value_option_retention_runtime = 70602; + */ +export const enum_value_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 16); + +/** + * @generated from extension: optional string enum_value_option_retention_source = 70603; + */ +export const enum_value_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 17); + +/** + * @generated from extension: optional string service_option_retention_unknown = 70701; + */ +export const service_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 18); + +/** + * @generated from extension: optional string service_option_retention_runtime = 70702; + */ +export const service_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 19); + +/** + * @generated from extension: optional string service_option_retention_source = 70703; + */ +export const service_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 20); + +/** + * @generated from extension: optional string method_option_retention_unknown = 70801; + */ +export const method_option_retention_unknown: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 21); + +/** + * @generated from extension: optional string method_option_retention_runtime = 70802; + */ +export const method_option_retention_runtime: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 22); + +/** + * @generated from extension: optional string method_option_retention_source = 70803; + */ +export const method_option_retention_source: GenDescExtension = /*@__PURE__*/ + extDesc(fileDesc_extra_options, 23); + diff --git a/packages/protobuf-test/src/generate-code.test.ts b/packages/protobuf-test/src/generate-code.test.ts index 675498523..975970b5a 100644 --- a/packages/protobuf-test/src/generate-code.test.ts +++ b/packages/protobuf-test/src/generate-code.test.ts @@ -29,6 +29,154 @@ import * as test_messages_proto2_ts from "./gen/ts/google/protobuf/test_messages import * as test_messages_proto2_js from "./gen/js/google/protobuf/test_messages_proto2_pb.js"; import * as test_messages_proto3_ts from "./gen/ts/google/protobuf/test_messages_proto3_pb.js"; import * as test_messages_proto3_js from "./gen/js/google/protobuf/test_messages_proto3_pb.js"; +import * as options_ts from "./gen/ts/extra/options_pb.js"; +import * as option_usage_ts from "./gen/ts/extra/option-usage_pb.js"; +import assert from "node:assert"; +import { getExtension, hasExtension } from "@bufbuild/protobuf"; + +describe("custom options from generated code", () => { + test("can be read via extensions", () => { + const fileOptions = + option_usage_ts.fileDesc_extra_option_usage.proto.options; + assert(fileOptions); + expect( + getExtension(fileOptions, options_ts.file_option_retention_unknown), + ).toBe("file option retention unknown"); + expect( + getExtension(fileOptions, options_ts.file_option_retention_runtime), + ).toBe("file option retention runtime"); + + const messageOptions = option_usage_ts.MessageWithOptionsDesc.proto.options; + assert(messageOptions); + expect( + getExtension(messageOptions, options_ts.message_option_retention_unknown), + ).toBe("message option retention unknown"); + expect( + getExtension(messageOptions, options_ts.message_option_retention_runtime), + ).toBe("message option retention runtime"); + + const fieldOptions = + option_usage_ts.MessageWithOptionsDesc.fields[0].proto.options; + assert(fieldOptions); + expect( + getExtension(fieldOptions, options_ts.field_option_retention_unknown), + ).toBe("field option retention unknown"); + expect( + getExtension(fieldOptions, options_ts.field_option_retention_runtime), + ).toBe("field option retention runtime"); + + const oneofOptions = + option_usage_ts.MessageWithOptionsDesc.oneofs[0].proto.options; + assert(oneofOptions); + expect( + getExtension(oneofOptions, options_ts.oneof_option_retention_unknown), + ).toBe("oneof option retention unknown"); + expect( + getExtension(oneofOptions, options_ts.oneof_option_retention_runtime), + ).toBe("oneof option retention runtime"); + + const enumOptions = option_usage_ts.EnumWithOptionsDesc.proto.options; + assert(enumOptions); + expect( + getExtension(enumOptions, options_ts.enum_option_retention_unknown), + ).toBe("enum option retention unknown"); + expect( + getExtension(enumOptions, options_ts.enum_option_retention_runtime), + ).toBe("enum option retention runtime"); + + const enumValueOptions = + option_usage_ts.EnumWithOptionsDesc.values[0].proto.options; + assert(enumValueOptions); + expect( + getExtension( + enumValueOptions, + options_ts.enum_value_option_retention_unknown, + ), + ).toBe("enum value option retention unknown"); + expect( + getExtension( + enumValueOptions, + options_ts.enum_value_option_retention_runtime, + ), + ).toBe("enum value option retention runtime"); + + const serviceOptions = option_usage_ts.ServiceWithOptions.proto.options; + assert(serviceOptions); + expect( + getExtension(serviceOptions, options_ts.service_option_retention_unknown), + ).toBe("service option retention unknown"); + expect( + getExtension(serviceOptions, options_ts.service_option_retention_runtime), + ).toBe("service option retention runtime"); + + const methodOptions = + option_usage_ts.ServiceWithOptions.methods[0].proto.options; + assert(methodOptions); + expect( + getExtension(methodOptions, options_ts.method_option_retention_unknown), + ).toBe("method option retention unknown"); + expect( + getExtension(methodOptions, options_ts.method_option_retention_runtime), + ).toBe("method option retention runtime"); + }); + test("are unavailable for source retention options", () => { + const fileOptions = + option_usage_ts.fileDesc_extra_option_usage.proto.options; + assert(fileOptions); + expect( + hasExtension(fileOptions, options_ts.file_option_retention_source), + ).toBe(false); + + const messageOptions = option_usage_ts.MessageWithOptionsDesc.proto.options; + assert(messageOptions); + expect( + hasExtension(messageOptions, options_ts.message_option_retention_source), + ).toBe(false); + + const fieldOptions = + option_usage_ts.MessageWithOptionsDesc.fields[0].proto.options; + assert(fieldOptions); + expect( + hasExtension(fieldOptions, options_ts.field_option_retention_source), + ).toBe(false); + + const oneofOptions = + option_usage_ts.MessageWithOptionsDesc.oneofs[0].proto.options; + assert(oneofOptions); + expect( + hasExtension(oneofOptions, options_ts.oneof_option_retention_source), + ).toBe(false); + + const enumOptions = option_usage_ts.EnumWithOptionsDesc.proto.options; + assert(enumOptions); + expect( + hasExtension(enumOptions, options_ts.enum_option_retention_source), + ).toBe(false); + + const enumValueOptions = + option_usage_ts.EnumWithOptionsDesc.values[0].proto.options; + assert(enumValueOptions); + expect( + hasExtension( + enumValueOptions, + options_ts.enum_value_option_retention_source, + ), + ).toBe(false); + + const serviceOptions = option_usage_ts.ServiceWithOptions.proto.options; + assert(serviceOptions); + expect( + hasExtension(serviceOptions, options_ts.service_option_retention_source), + ).toBe(false); + + const methodOptions = + option_usage_ts.ServiceWithOptions.methods[0].proto.options; + assert(methodOptions); + expect( + hasExtension(methodOptions, options_ts.method_option_retention_source), + ).toBe(false); + }); +}); test("ts generated code is assignable to js", () => { expect([ diff --git a/packages/protobuf/src/codegenv1/embed.ts b/packages/protobuf/src/codegenv1/embed.ts index 88a9903bb..2f1b4dbc0 100644 --- a/packages/protobuf/src/codegenv1/embed.ts +++ b/packages/protobuf/src/codegenv1/embed.ts @@ -15,7 +15,6 @@ import type { DescEnum, DescExtension, - DescFile, DescMessage, DescService, } from "../desc-types.js"; @@ -66,12 +65,12 @@ type EmbedDescriptorProto = Omit & { * @private */ export function embedFileDesc( - file: DescFile, + file: FileDescriptorProto, ): EmbedUnknown | EmbedDescriptorProto { const embed: EmbedUnknown = { bootable: false, proto() { - const stripped = clone(FileDescriptorProtoDesc, file.proto); + const stripped = clone(FileDescriptorProtoDesc, file); clearField(FileDescriptorProtoDesc, stripped, "dependency"); clearField(FileDescriptorProtoDesc, stripped, "sourceCodeInfo"); stripped.messageType.map(stripJsonNames); @@ -82,7 +81,7 @@ export function embedFileDesc( return base64Encode(bytes, "std_raw"); }, }; - return file.proto.name == "google/protobuf/descriptor.proto" + return file.name == "google/protobuf/descriptor.proto" ? { ...embed, bootable: true, diff --git a/packages/protoc-gen-es/src/protoc-gen-es-plugin.ts b/packages/protoc-gen-es/src/protoc-gen-es-plugin.ts index 01a82a107..88e55a0c7 100644 --- a/packages/protoc-gen-es/src/protoc-gen-es-plugin.ts +++ b/packages/protoc-gen-es/src/protoc-gen-es-plugin.ts @@ -53,7 +53,7 @@ function generateTs(schema: Schema) { const fileDesc = f.importDesc(file); generateDescDoc(f, file); f.print(f.exportDecl("const", fileDesc.name), ": ", GenDescFile, " = ", pure); - f.print(" ", getFileDescCall(f, file), ";"); + f.print(" ", getFileDescCall(f, file, schema), ";"); f.print(); for (const desc of schema.typesInFile(file)) { switch (desc.kind) { @@ -116,7 +116,7 @@ function generateJs(schema: Schema) { const fileDesc = f.importDesc(file); generateDescDoc(f, file); f.print(f.exportDecl("const", fileDesc.name), " = ", pure); - f.print(" ", getFileDescCall(f, file), ";"); + f.print(" ", getFileDescCall(f, file, schema), ";"); f.print(); for (const desc of schema.typesInFile(file)) { switch (desc.kind) { @@ -263,8 +263,13 @@ function generateDescDoc( } // prettier-ignore -function getFileDescCall(f: GeneratedFile, file: DescFile) { - const info = embedFileDesc(file); +function getFileDescCall(f: GeneratedFile, file: DescFile, schema: Schema) { + // Schema provides files with source retention options. Since we do not want to + // embed source retention options in generated code, we use FileDescriptorProto + // messages from CodeGeneratorRequest.proto_file instead. + const sourceFile = file.proto; + const runtimeFile = schema.proto.protoFile.find(f => f.name == sourceFile.name); + const info = embedFileDesc(runtimeFile ?? sourceFile); if (info.bootable && !f.runtime.create.from.startsWith("@bufbuild/protobuf")) { // google/protobuf/descriptor.proto is embedded as a plain object when // bootstrapping to avoid recursion diff --git a/packages/protoplugin-test/src/custom-options.test.ts b/packages/protoplugin-test/src/custom-options.test.ts index 98a71323b..02fe256ac 100644 --- a/packages/protoplugin-test/src/custom-options.test.ts +++ b/packages/protoplugin-test/src/custom-options.test.ts @@ -12,26 +12,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { describe, expect, test } from "@jest/globals"; +import { beforeEach, describe, expect, test } from "@jest/globals"; +import { + type DescExtension, + fromBinary, + hasExtension, + getExtension, +} from "@bufbuild/protobuf"; +import { + type CodeGeneratorRequest, + CodeGeneratorRequestDesc, +} from "@bufbuild/protobuf/wkt"; +import type { Schema } from "@bufbuild/protoplugin/ecmascript"; +import { UpstreamProtobuf } from "upstream-protobuf"; +import { compileFile, createTestPluginAndRun } from "./helpers.js"; import assert from "node:assert"; -import { getExtension } from "@bufbuild/protobuf"; -import { compileFile } from "./helpers.js"; -import { createTestPluginAndRun } from "./helpers.js"; describe("custom options", () => { const proto = ` syntax = "proto3"; import "google/protobuf/descriptor.proto"; - package testcustomoptions; - option (testcustomoptions.uint32_option) = 12345; + option (opt) = 123; extend google.protobuf.FileOptions { - optional uint32 uint32_option = 60123; + optional uint32 opt = 60123; } `; test("can be read via extension", async () => { - const ext = (await compileFile(proto)).extensions[0]; - assert(ext); - let readOptionValue: unknown; + const opt = (await compileFile(proto)).extensions[0]; + assert(opt); + let value: unknown; await createTestPluginAndRun({ proto: { "input.proto": proto, @@ -39,18 +48,131 @@ describe("custom options", () => { generateAny(_, schema) { const file = schema.files.find((f) => f.proto.name == "input.proto"); if (file?.proto.options) { - readOptionValue = getExtension(file.proto.options, ext); + value = getExtension(file.proto.options, opt); } }, }); - expect(readOptionValue).toBe(12345); + expect(value).toBe(123); }); - test("can be read via extension directly from the descriptor", async () => { - const file = await compileFile(proto); - const ext = file.extensions[0]; - assert(ext); - assert(file.proto.options); - const value = getExtension(file.proto.options, ext); - expect(value).toBe(12345); +}); + +describe("option retention", () => { + const proto = { + "a.proto": ` + syntax = "proto3"; + import "options.proto"; + import "b.proto"; + option (file_option_retention_unknown) = "a option"; + option (file_option_retention_runtime) = "a runtime option"; + option (file_option_retention_source) = "a source option"; + `, + "b.proto": ` + syntax = "proto3"; + import "options.proto"; + option (file_option_retention_unknown) = "b option"; + option (file_option_retention_runtime) = "b runtime option"; + option (file_option_retention_source) = "b source option"; + `, + "options.proto": ` + syntax = "proto3"; + import "google/protobuf/descriptor.proto"; + extend google.protobuf.FileOptions { + optional string file_option_retention_unknown = 70101; + optional string file_option_retention_runtime = 70102 [retention = RETENTION_RUNTIME]; + optional string file_option_retention_source = 70103 [retention = RETENTION_SOURCE]; + } + `, + }; + describe("CodeGeneratorRequest", () => { + let req: CodeGeneratorRequest; + let opt_unknown: DescExtension, + opt_source: DescExtension, + opt_runtime: DescExtension; + beforeEach(async () => { + const reqBytes = await new UpstreamProtobuf().createCodeGeneratorRequest( + proto, + { + filesToGenerate: ["a.proto"], + }, + ); + req = fromBinary(CodeGeneratorRequestDesc, reqBytes); + [opt_unknown, opt_source, opt_runtime] = ( + await compileFile(proto["options.proto"]) + ).extensions; + }); + test("includes expected files", () => { + expect(req.fileToGenerate).toStrictEqual(["a.proto"]); + expect(req.protoFile.map((f) => f.name)).toStrictEqual([ + "google/protobuf/descriptor.proto", + "options.proto", + "b.proto", + "a.proto", + ]); + expect(req.sourceFileDescriptors.map((f) => f.name)).toStrictEqual([ + "a.proto", + ]); + }); + test("proto_file elides source retention options for file_to_generate", () => { + const fileA = req.protoFile.find((f) => f.name == "a.proto"); + assert(fileA?.options); + expect(hasExtension(fileA.options, opt_unknown)).toBe(true); + expect(hasExtension(fileA.options, opt_source)).toBe(true); + expect(hasExtension(fileA.options, opt_runtime)).toBe(false); + }); + test("proto_file includes source retention options for files not in file_to_generate", () => { + const fileB = req.protoFile.find((f) => f.name == "b.proto"); + assert(fileB?.options); + expect(hasExtension(fileB.options, opt_unknown)).toBe(true); + expect(hasExtension(fileB.options, opt_source)).toBe(true); + expect(hasExtension(fileB.options, opt_runtime)).toBe(true); + }); + test("source_file_descriptors include source retention options for file_to_generate", () => { + const fileA = req.sourceFileDescriptors.find((f) => f.name == "a.proto"); + assert(fileA?.options); + expect(hasExtension(fileA.options, opt_unknown)).toBe(true); + expect(hasExtension(fileA.options, opt_source)).toBe(true); + expect(hasExtension(fileA.options, opt_runtime)).toBe(true); + }); + }); + describe("protoplugin's Schema", () => { + let schema: Schema; + let opt_unknown: DescExtension, + opt_runtime: DescExtension, + opt_source: DescExtension; + beforeEach(async () => { + await createTestPluginAndRun({ + proto, + generateAny(_, pluginSchema) { + schema = pluginSchema; + }, + filesToGenerate: ["a.proto"], + }); + [opt_unknown, opt_runtime, opt_source] = ( + await compileFile(proto["options.proto"]) + ).extensions; + }); + test("includes expected files", () => { + expect(schema.files.map((f) => f.proto.name)).toStrictEqual(["a.proto"]); + expect(schema.allFiles.map((f) => f.proto.name)).toStrictEqual([ + "google/protobuf/descriptor.proto", + "options.proto", + "b.proto", + "a.proto", + ]); + }); + test("files include source retention options", () => { + const file = schema.files.find((f) => f.proto.name == "a.proto"); + assert(file?.proto.options); + expect(hasExtension(file.proto.options, opt_unknown)).toBe(true); + expect(hasExtension(file.proto.options, opt_runtime)).toBe(true); + expect(hasExtension(file.proto.options, opt_source)).toBe(true); + }); + test("allFiles include source retention options", () => { + const file = schema.allFiles.find((f) => f.proto.name == "b.proto"); + assert(file?.proto.options); + expect(hasExtension(file.proto.options, opt_unknown)).toBe(true); + expect(hasExtension(file.proto.options, opt_runtime)).toBe(true); + expect(hasExtension(file.proto.options, opt_source)).toBe(true); + }); }); }); diff --git a/packages/protoplugin-test/src/helpers.ts b/packages/protoplugin-test/src/helpers.ts index d85123395..39c20b362 100644 --- a/packages/protoplugin-test/src/helpers.ts +++ b/packages/protoplugin-test/src/helpers.ts @@ -12,7 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import type { CodeGeneratorResponse } from "@bufbuild/protobuf/wkt"; +import type { + CodeGeneratorResponse, + FileDescriptorSet, +} from "@bufbuild/protobuf/wkt"; import { CodeGeneratorRequestDesc, FileDescriptorSetDesc, @@ -119,6 +122,16 @@ export async function createTestPluginAndRun( return res; } +export async function compileFileDescriptorSet( + files: Record, +): Promise { + upstreamProtobuf = upstreamProtobuf ?? new UpstreamProtobuf(); + const bytes = await upstreamProtobuf.compileToDescriptorSet(files, { + includeImports: true, + }); + return fromBinary(FileDescriptorSetDesc, bytes); +} + export async function compileFile(proto: string) { upstreamProtobuf = upstreamProtobuf ?? new UpstreamProtobuf(); const bytes = await upstreamProtobuf.compileToDescriptorSet( diff --git a/packages/protoplugin/src/ecmascript/schema.ts b/packages/protoplugin/src/ecmascript/schema.ts index 4abe1e831..bcc59df29 100644 --- a/packages/protoplugin/src/ecmascript/schema.ts +++ b/packages/protoplugin/src/ecmascript/schema.ts @@ -216,9 +216,19 @@ function getFilesToGenerate( } } } + // Our goal is to provide options with source retention to plugin authors. + // CodeGeneratorRequest.proto_file elides options with source retention for + // files to generate. For these files, we take the file from source_file_descriptors, + // which does include options with source retention. + const allProtoWithSourceOptions = request.protoFile.map((protoFile) => { + const sourceFile = request.sourceFileDescriptors.find( + (s) => s.name == protoFile.name, + ); + return sourceFile ?? protoFile; + }); const registry = createFileRegistry( create(FileDescriptorSetDesc, { - file: request.protoFile, + file: allProtoWithSourceOptions, }), ); const allFiles: DescFile[] = [];