Skip to content

Commit

Permalink
number type in jsDoc is uint32 to protobuf by default
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Jul 23, 2017
1 parent 62b0b30 commit 9598efd
Show file tree
Hide file tree
Showing 5 changed files with 316 additions and 92 deletions.
144 changes: 121 additions & 23 deletions demo/debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@
"resaveFailedLogs": "resave failed logs"
}
},
{
"kind": "enum",
"name": "ProtocolKind",
"type": "string",
"members": {
"flows": "flows",
"historySamples": "history samples",
"searchLogsResult": "search logs result",
"searchSamplesResult": "search samples result",
"resaveFailedLogsResult": "resave failed logs result"
}
},
{
"kind": "enum",
"name": "ResultKind",
"type": "string",
"members": {
"success": "success",
"fail": "fail"
}
},
{
"kind": "enum",
"name": "FlowKind",
Expand All @@ -21,20 +42,7 @@
{
"kind": "object",
"name": "RequestProtocol",
"members": [
{
"name": "requestId",
"type": "uint32",
"optional": true,
"tag": 1
},
{
"name": "error",
"type": "string",
"optional": true,
"tag": 2
}
],
"members": [],
"isEntry": true
},
{
Expand All @@ -61,13 +69,13 @@
},
{
"name": "from",
"type": "uint32",
"type": "number",
"optional": false,
"tag": 4
},
{
"name": "size",
"type": "uint32",
"type": "number",
"optional": false,
"tag": 5
}
Expand Down Expand Up @@ -95,26 +103,100 @@
},
{
"kind": "object",
"name": "SearchLogsResult",
"name": "ResponseProtocol",
"members": [
{
"name": "total",
"type": "uint32",
"name": "kind",
"type": {
"kind": "enum",
"type": "string",
"enums": [
"flows",
"history samples",
"search logs result",
"search samples result",
"resave failed logs result"
]
},
"optional": false,
"tag": 1
},
{
"name": "logs",
"name": "flows",
"type": "Flows",
"optional": true,
"tag": 2
},
{
"name": "historySamples",
"type": {
"kind": "array",
"element": "Log"
"element": "SampleFrame"
},
"optional": true,
"tag": 3
},
{
"name": "searchLogsResult",
"type": "SearchLogsResult",
"optional": true,
"tag": 4
},
{
"name": "searchSamplesResult",
"type": "SearchSamplesResult",
"optional": true,
"tag": 5
},
{
"name": "resaveFailedLogsResult",
"type": "ResaveFailedLogsResult",
"optional": true,
"tag": 6
}
],
"isEntry": false
},
{
"kind": "object",
"name": "Flows",
"members": [
{
"name": "serverTime",
"type": "string",
"optional": false,
"tag": 1
},
{
"name": "flows",
"type": {
"kind": "array",
"element": "Flow"
},
"optional": true,
"tag": 2
}
],
"isEntry": false
},
{
"kind": "object",
"name": "SearchLogsResult",
"members": [],
"isEntry": false
},
{
"kind": "object",
"name": "SearchSamplesResult",
"members": [],
"isEntry": false
},
{
"kind": "object",
"name": "ResaveFailedLogsResult",
"members": [],
"isEntry": false
},
{
"kind": "object",
"name": "SampleFrame",
Expand All @@ -137,6 +219,22 @@
],
"isEntry": false
},
{
"kind": "object",
"name": "FlowProtocol",
"members": [
{
"name": "flows",
"type": {
"kind": "array",
"element": "Flow"
},
"optional": true,
"tag": 1
}
],
"isEntry": false
},
{
"kind": "object",
"name": "Flow",
Expand Down Expand Up @@ -212,7 +310,7 @@
},
{
"name": "port",
"type": "uint32",
"type": "number",
"optional": true,
"tag": 2
},
Expand All @@ -221,7 +319,7 @@
"type": {
"kind": "map",
"key": "string",
"value": "uint32"
"value": "number"
},
"optional": false,
"tag": 3
Expand Down
105 changes: 74 additions & 31 deletions demo/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
"definitions": {
"RequestProtocol": {
"type": "object",
"properties": {
"requestId": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"error": {
"type": "string"
}
},
"properties": {},
"required": []
},
"SearchLogs": {
Expand All @@ -27,14 +18,10 @@
"type": "string"
},
"from": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
"type": "number"
},
"size": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
"type": "number"
}
},
"required": [
Expand All @@ -60,26 +47,74 @@
"to"
]
},
"SearchLogsResult": {
"ResponseProtocol": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"flows",
"history samples",
"search logs result",
"search samples result",
"resave failed logs result"
]
},
"flows": {
"type": "Flows"
},
"historySamples": {
"type": "array",
"items": {
"$ref": "#/definitions/SampleFrame"
}
},
"searchLogsResult": {
"type": "SearchLogsResult"
},
"searchSamplesResult": {
"type": "SearchSamplesResult"
},
"resaveFailedLogsResult": {
"type": "ResaveFailedLogsResult"
}
},
"required": [
"kind"
]
},
"Flows": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
"serverTime": {
"type": "string"
},
"logs": {
"flows": {
"type": "array",
"items": {
"$ref": "#/definitions/Log"
"$ref": "#/definitions/Flow"
}
}
},
"required": [
"total",
"logs"
"serverTime"
]
},
"SearchLogsResult": {
"type": "object",
"properties": {},
"required": []
},
"SearchSamplesResult": {
"type": "object",
"properties": {},
"required": []
},
"ResaveFailedLogsResult": {
"type": "object",
"properties": {},
"required": []
},
"SampleFrame": {
"type": "object",
"properties": {
Expand All @@ -97,6 +132,18 @@
"time"
]
},
"FlowProtocol": {
"type": "object",
"properties": {
"flows": {
"type": "array",
"items": {
"$ref": "#/definitions/Flow"
}
}
},
"required": []
},
"Flow": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -148,16 +195,12 @@
"type": "string"
},
"port": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
"type": "number"
},
"values": {
"type": "object",
"additionalProperties": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295
"type": "number"
}
}
},
Expand Down
Loading

0 comments on commit 9598efd

Please sign in to comment.