Skip to content

Commit

Permalink
Changed schema for JSON test to be defined in a .proto file. (protoco…
Browse files Browse the repository at this point in the history
…lbuffers#54)

* Changed schema for JSON test to be defined in a .proto file.

Before we had lots of code to build these schemas manually,
but this was verbose and made it difficult to add to the
schema easily.  Now we can just write a .proto file and
adding fields is easy.

To avoid making the tests depend on upbc (and thus Lua)
we check in the generated schema.

* Made protobuf-compiler a dependency of "make genfiles."

* For genfiles download recent protoc that can handle proto3.

* Only use new protoc for genfiles.
  • Loading branch information
haberman committed Apr 19, 2016
1 parent 30ba90b commit 9f8f51a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/json/test.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
syntax = "proto3";

package upb.test.json;

message TestMessage {
int32 optional_int32 = 1;
int64 optional_int64 = 2;
int32 optional_uint32 = 3;
int64 optional_uint64 = 4;
string optional_string = 5;
bytes optional_bytes = 6;
bool optional_bool = 7;
SubMessage optional_msg = 8;
MyEnum optional_enum = 9;

repeated int32 repeated_int32 = 11;
repeated int64 repeated_int64 = 12;
repeated uint32 repeated_uint32 = 13;
repeated uint64 repeated_uint64 = 14;
repeated string repeated_string = 15;
repeated bytes repeated_bytes = 16;
repeated bool repeated_bool = 17;
repeated SubMessage repeated_msg = 18;
repeated MyEnum repeated_enum = 19;

map<string, string> map_string_string = 20;
map<int32, string> map_int32_string = 21;
map<bool, string> map_bool_string = 22;
map<string, int32> map_string_int32 = 23;
map<string, bool> map_string_bool = 24;
map<string, SubMessage> map_string_msg = 25;
}

message SubMessage {
int32 foo = 1;
}

enum MyEnum {
A = 0;
B = 1;
C = 2;
}

0 comments on commit 9f8f51a

Please sign in to comment.