forked from mafintosh/protocol-buffers-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.mjs
43 lines (42 loc) · 936 Bytes
/
example.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { parse } from './parse.mjs';
let parsed = parse(`syntax = "proto3";
package example;
option java_package = "com.example";
option optimize_for = SPEED;
import "other.proto";
// example file
enum Hello {
Hello = 0;
Welcome = 1;
GDay = 2;
Yo = 3;
}
message Test {
map<string, string> data = 1;
required string hello = 2;
oneof test {
uint32 age = 3;
uint32 year = 4;
}
message Nested {
optional bytes thing = 1;
}
Nested item = 5;
required Hello welcoming = 6;
/** A block comment
* Longer
* Longer
*/
repeated uint32 timings = 7[deprecated=true];
repeated uint32 timings_info = 8 [packed=true];
}
service ServiceName {
rpc MethodName (Hello) returns (Test);
}
`);
console.log('Parsed:');
console.dir(parsed, { depth: Infinity });
console.log(JSON.stringify(parsed, null, 2));
console.log('Stringified:');
console.log(parsed.toString());
//# sourceMappingURL=example.mjs.map