blob: 112161d99e5d3a4eb170ca6b8be1f7f6fceb210d [file] [log] [blame]
// Copyright 2019 The Pigweed Authors
//
// 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.
syntax = "proto3";
// This is a test .proto file for pw_protobuf's codegen implementation.
package pw.protobuf.test;
// Top-level enum definition.
enum Bool {
TRUE = 0;
FALSE = 1;
FILE_NOT_FOUND = 2;
}
// A message!
message Pigweed {
// Nested messages and enums.
message Pigweed {
enum Binary {
ZERO = 0;
ONE = 1;
};
Bool status = 1;
}
message Protobuf {
enum Binary {
ONE = 0;
ZERO = 1;
};
// We must go deeper.
message Compiler {
enum Status {
OK = 0;
ERROR = 1;
FUBAR = 2;
}
string file_name = 1;
Status status = 2;
Binary protobuf_bin = 3;
Pigweed.Binary pigweed_bin = 4;
}
Binary binary_value = 1;
}
// Regular types.
uint32 magic_number = 1;
sint32 ziggy = 2;
fixed64 cycles = 3;
float ratio = 4;
string error_message = 5;
DeviceInfo device_info = 6;
// Nested messages and enums as fields.
Pigweed pigweed = 7;
Protobuf.Binary bin = 8;
Proto proto = 9;
repeated Proto.ID id = 10;
}
// Another message.
message Proto {
enum Binary {
OFF = 0;
ON = 1;
};
message ID {
uint32 id = 1;
}
// Circular dependency with Pigweed.
Pigweed pigweed = 1;
// Same name, different namespace.
Binary bin = 2;
Pigweed.Pigweed.Binary pigweed_pigweed_bin = 3;
Pigweed.Protobuf.Binary pigweed_protobuf_bin = 4;
Pigweed.Protobuf.Compiler meta = 5;
}
// Yet another message.
message DeviceInfo {
enum DeviceStatus {
OK = 0;
ASSERT = 1;
FAULT = 2;
PANIC = 3;
}
string device_name = 1;
fixed32 device_id = 2;
DeviceStatus status = 3;
repeated KeyValuePair attributes = 4;
}
// This might be useful.
message KeyValuePair {
string key = 1;
string value = 2;
}