Skip to content

Instantly share code, notes, and snippets.

@south37
Created September 4, 2018 06:41
Show Gist options
  • Save south37/7a9254c206ef55063b25c117b11a2c9f to your computer and use it in GitHub Desktop.
Save south37/7a9254c206ef55063b25c117b11a2c9f to your computer and use it in GitHub Desktop.
.proto ファイルの内容を parse した情報を protoc-gen-json (https://github.com/sourcegraph/prototools/blob/master/README.json.md) で dump
syntax = "proto3";
package resources;
message User {
int32 id = 1;
Profile profile = 2;
}
message Profile {
int32 id = 1;
string name = 2;
}
{
"file_to_generate": [
"resources.proto"
],
"parameter": "out=resources.proto.json",
"proto_file": [
{
"name": "resources.proto",
"package": "resources",
"message_type": [
{
"name": "User",
"field": [
{
"name": "id",
"number": 1,
"label": 1,
"type": 5,
"json_name": "id"
},
{
"name": "profile",
"number": 2,
"label": 1,
"type": 11,
"type_name": ".resources.Profile",
"json_name": "profile"
}
]
},
{
"name": "Profile",
"field": [
{
"name": "id",
"number": 1,
"label": 1,
"type": 5,
"json_name": "id"
},
{
"name": "name",
"number": 2,
"label": 1,
"type": 9,
"json_name": "name"
}
]
}
],
"source_code_info": {
"location": [
{
"span": [
0,
0,
11,
1
]
},
{
"path": [
12
],
"span": [
0,
0,
18
]
},
{
"path": [
2
],
"span": [
1,
8,
17
]
},
{
"path": [
4,
0
],
"span": [
3,
0,
6,
1
]
},
{
"path": [
4,
0,
1
],
"span": [
3,
8,
12
]
},
{
"path": [
4,
0,
2,
0
],
"span": [
4,
2,
15
]
},
{
"path": [
4,
0,
2,
0,
4
],
"span": [
4,
2,
3,
14
]
},
{
"path": [
4,
0,
2,
0,
5
],
"span": [
4,
2,
7
]
},
{
"path": [
4,
0,
2,
0,
1
],
"span": [
4,
8,
10
]
},
{
"path": [
4,
0,
2,
0,
3
],
"span": [
4,
13,
14
]
},
{
"path": [
4,
0,
2,
1
],
"span": [
5,
2,
22
]
},
{
"path": [
4,
0,
2,
1,
4
],
"span": [
5,
2,
4,
15
]
},
{
"path": [
4,
0,
2,
1,
6
],
"span": [
5,
2,
9
]
},
{
"path": [
4,
0,
2,
1,
1
],
"span": [
5,
10,
17
]
},
{
"path": [
4,
0,
2,
1,
3
],
"span": [
5,
20,
21
]
},
{
"path": [
4,
1
],
"span": [
8,
0,
11,
1
]
},
{
"path": [
4,
1,
1
],
"span": [
8,
8,
15
]
},
{
"path": [
4,
1,
2,
0
],
"span": [
9,
2,
15
]
},
{
"path": [
4,
1,
2,
0,
4
],
"span": [
9,
2,
8,
17
]
},
{
"path": [
4,
1,
2,
0,
5
],
"span": [
9,
2,
7
]
},
{
"path": [
4,
1,
2,
0,
1
],
"span": [
9,
8,
10
]
},
{
"path": [
4,
1,
2,
0,
3
],
"span": [
9,
13,
14
]
},
{
"path": [
4,
1,
2,
1
],
"span": [
10,
2,
18
]
},
{
"path": [
4,
1,
2,
1,
4
],
"span": [
10,
2,
9,
15
]
},
{
"path": [
4,
1,
2,
1,
5
],
"span": [
10,
2,
8
]
},
{
"path": [
4,
1,
2,
1,
1
],
"span": [
10,
9,
13
]
},
{
"path": [
4,
1,
2,
1,
3
],
"span": [
10,
16,
17
]
}
]
},
"syntax": "proto3"
}
],
"compiler_version": {
"major": 3,
"minor": 5,
"patch": 1,
"suffix": ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment