| // Copyright 2026 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. | |
| // | |
| edition = "2026"; | |
| package cbor_test; | |
| import "cbor/tags.proto"; | |
| import "cbor/test/external.proto"; | |
| import "cbor/test/external_skip.proto"; | |
| import "google/protobuf/timestamp.proto"; | |
| message TestMessage { | |
| string name = 1 [(cbor.tags) = { name: "Name" }]; | |
| int32 version = 2 [(cbor.tags) = { name: "Version" }]; | |
| } | |
| message RequiredMessage { | |
| string required_field = 1 | |
| [(cbor.tags) = { name: "RequiredField", is_required: true }]; | |
| } | |
| message RequiredDisallowEmptyMessage { | |
| repeated string required_non_empty_list = 1 [(cbor.tags) = { | |
| name: "RequiredNonEmptyList", | |
| is_required: true, | |
| disallow_empty: true | |
| }]; | |
| } | |
| message OptionalDisallowEmptyMessage { | |
| repeated string optional_non_empty_list = 1 | |
| [(cbor.tags) = { name: "OptionalNonEmptyList", disallow_empty: true }]; | |
| } | |
| message RequiredRepeatedMessage { | |
| repeated string required_repeated_field = 1 | |
| [(cbor.tags) = { name: "RequiredRepeatedField", is_required: true }]; | |
| repeated string not_required_repeated_field = 2 | |
| [(cbor.tags) = { name: "NotRequiredRepeatedField" }]; | |
| } | |
| message TypeOverrideMessage { | |
| bytes text_as_bytes = 1 | |
| [(cbor.tags) = { name: "TextAsBytes", type: TYPE_TEXT_STRING }]; | |
| string bytes_as_text = 2 | |
| [(cbor.tags) = { name: "BytesAsText", type: TYPE_BYTE_STRING }]; | |
| int32 uint_as_int = 3 [(cbor.tags) = { name: "UintAsInt", type: TYPE_UINT }]; | |
| } | |
| message NestedMessage { | |
| string value = 1 [(cbor.tags) = { name: "Value" }]; | |
| } | |
| message ComplexMessage { | |
| int32 int32_field = 1 [(cbor.tags) = { name: "Int32Field" }]; | |
| int64 int64_field = 2 [(cbor.tags) = { name: "Int64Field" }]; | |
| uint32 uint32_field = 3 [(cbor.tags) = { name: "Uint32Field" }]; | |
| uint64 uint64_field = 4 [(cbor.tags) = { name: "Uint64Field" }]; | |
| string string_field = 5 [(cbor.tags) = { name: "StringField" }]; | |
| bytes bytes_field = 6 [(cbor.tags) = { name: "BytesField" }]; | |
| bool bool_field = 7 [(cbor.tags) = { name: "BoolField" }]; | |
| float float_field = 8 [(cbor.tags) = { name: "FloatField" }]; | |
| double double_field = 9 [(cbor.tags) = { name: "DoubleField" }]; | |
| repeated int32 repeated_int32 = 10 [(cbor.tags) = { name: "RepeatedInt32" }]; | |
| repeated string repeated_string = 11 | |
| [(cbor.tags) = { name: "RepeatedString" }]; | |
| NestedMessage nested = 12 [(cbor.tags) = { name: "Nested" }]; | |
| repeated NestedMessage repeated_nested = 13 | |
| [(cbor.tags) = { name: "RepeatedNested" }]; | |
| repeated bytes repeated_bytes = 20 [(cbor.tags) = { name: "RepeatedBytes" }]; | |
| repeated string repeated_string_array = 21 | |
| [(cbor.tags) = { name: "RepeatedStringArray" }]; | |
| repeated int64 repeated_int64 = 22 [(cbor.tags) = { name: "RepeatedInt64" }]; | |
| repeated uint32 repeated_uint32 = 23 | |
| [(cbor.tags) = { name: "RepeatedUint32" }]; | |
| repeated uint64 repeated_uint64 = 24 | |
| [(cbor.tags) = { name: "RepeatedUint64" }]; | |
| repeated bool repeated_bool = 25 [(cbor.tags) = { name: "RepeatedBool" }]; | |
| repeated float repeated_float = 26 [(cbor.tags) = { name: "RepeatedFloat" }]; | |
| repeated double repeated_double = 27 | |
| [(cbor.tags) = { name: "RepeatedDouble" }]; | |
| string read_only_field = 14 | |
| [(cbor.tags) = { name: "ReadOnly", mode: MODE_READ_ONLY }]; | |
| string write_only_field = 15 | |
| [(cbor.tags) = { name: "WriteOnly", mode: MODE_WRITE_ONLY }]; | |
| string skip_field = 16 [(cbor.tags) = { mode: MODE_SKIP }]; | |
| ExternalMessage external_field = 17 [(cbor.tags) = { name: "ExternalField" }]; | |
| ExternalSkipMessage skip_external_field = 18 | |
| [(cbor.tags) = { mode: MODE_SKIP }]; | |
| google.protobuf.Timestamp timestamp_field = 19 | |
| [(cbor.tags) = { mode: MODE_SKIP }]; | |
| } |