blob: e157bc452ea01aa59943246ad7d28d05d75b762f [file] [log] [blame] [edit]
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto2";
package protobuf_unittest;
import "google/protobuf/descriptor.proto";
// Retention attributes set directly on custom options
extend google.protobuf.FileOptions {
optional int32 plain_option = 505092806;
optional int32 runtime_retention_option = 505039132
[retention = RETENTION_RUNTIME];
optional int32 source_retention_option = 504878676
[retention = RETENTION_SOURCE];
}
option (plain_option) = 1;
option (runtime_retention_option) = 2;
option (source_retention_option) = 3;
// Retention attributes set on fields nested within a message
message OptionsMessage {
optional int32 plain_field = 1;
optional int32 runtime_retention_field = 2 [retention = RETENTION_RUNTIME];
optional int32 source_retention_field = 3 [retention = RETENTION_SOURCE];
}
extend google.protobuf.FileOptions {
optional OptionsMessage file_option = 504871168;
}
option (file_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
// Retention attribute nested inside a repeated message field
extend google.protobuf.FileOptions {
repeated OptionsMessage repeated_options = 504823570;
}
option (repeated_options) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
extend google.protobuf.ExtensionRangeOptions {
optional OptionsMessage extension_range_option = 504822148;
}
extend google.protobuf.MessageOptions {
optional OptionsMessage message_option = 504820819;
}
extend google.protobuf.FieldOptions {
optional OptionsMessage field_option = 504589219;
}
extend google.protobuf.OneofOptions {
optional OptionsMessage oneof_option = 504479153;
}
extend google.protobuf.EnumOptions {
optional OptionsMessage enum_option = 504451567;
}
extend google.protobuf.EnumValueOptions {
optional OptionsMessage enum_entry_option = 504450522;
}
extend google.protobuf.ServiceOptions {
optional OptionsMessage service_option = 504387709;
}
extend google.protobuf.MethodOptions {
optional OptionsMessage method_option = 504349420;
}
message Extendee {
extensions 1, 2;
}
extend Extendee {
optional int32 i = 1 [(field_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
}];
}
message TopLevelMessage {
option (message_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
message NestedMessage {
option (message_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
}
enum NestedEnum {
option (enum_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
NESTED_UNKNOWN = 0;
}
optional float f = 1 [(field_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
}];
oneof o {
option (oneof_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
int64 i = 2;
}
extensions 10 to 100 [(extension_range_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
}];
extend Extendee {
optional string s = 2 [(field_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
}];
}
}
enum TopLevelEnum {
option (enum_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
TOP_LEVEL_UNKNOWN = 0 [(enum_entry_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
}];
}
service Service {
option (service_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
rpc DoStuff(TopLevelMessage) returns (TopLevelMessage) {
option (method_option) = {
plain_field: 1
runtime_retention_field: 2
source_retention_field: 3
};
}
}