-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,172 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
packages/protobuf-test/src/gen/js/extra/option-usage_pb.d.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
packages/protobuf-test/src/gen/js/extra/option-usage_pb.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.