Skip to content

Commit

Permalink
resolve definitions dependencies for generated json scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Jul 24, 2017
1 parent 1d9782b commit 65cd778
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 691 deletions.
246 changes: 2 additions & 244 deletions demo/flow-protocol.json
Original file line number Diff line number Diff line change
@@ -1,247 +1,6 @@
{
"$ref": "#/definitions/FlowProtocol",
"definitions": {
"RequestProtocol": {
"type": "object",
"properties": {
"requestId": {
"type": "number"
},
"kind": {
"type": "string",
"enum": [
"search logs",
"search samples",
"resave failed logs"
]
},
"searchLogs": {
"$ref": "#/definitions/SearchLogs"
},
"searchSamples": {
"$ref": "#/definitions/SearchSamples"
}
},
"required": [
"requestId",
"kind"
],
"additionalProperties": false,
"maxProperties": 3
},
"SearchLogs": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"time": {
"type": "string"
},
"hostname": {
"type": "string"
},
"from": {
"type": "number"
},
"size": {
"type": "number"
}
},
"required": [
"content",
"time",
"hostname",
"from",
"size"
],
"additionalProperties": false
},
"SearchSamples": {
"type": "object",
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
}
},
"required": [
"from",
"to"
],
"additionalProperties": false
},
"ResponseProtocol": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"flows",
"history samples",
"search logs result",
"search samples result",
"resave failed logs result"
]
},
"flows": {
"$ref": "#/definitions/Flows"
},
"historySamples": {
"type": "array",
"items": {
"$ref": "#/definitions/SampleFrame"
}
},
"searchLogsResult": {
"$ref": "#/definitions/SearchLogsResult"
},
"searchSamplesResult": {
"$ref": "#/definitions/SearchSamplesResult"
},
"resaveFailedLogsResult": {
"$ref": "#/definitions/ResaveFailedLogsResult"
}
},
"required": [
"kind"
],
"additionalProperties": false,
"maxProperties": 2
},
"Flows": {
"type": "object",
"properties": {
"serverTime": {
"type": "string"
},
"flows": {
"type": "array",
"items": {
"$ref": "#/definitions/Flow"
}
}
},
"required": [
"serverTime",
"flows"
],
"additionalProperties": false
},
"SearchLogsResult": {
"type": "object",
"properties": {
"requestId": {
"type": "number"
},
"kind": {
"type": "string",
"enum": [
"success",
"fail"
]
},
"total": {
"type": "number"
},
"logs": {
"type": "array",
"items": {
"$ref": "#/definitions/Log"
}
},
"error": {
"type": "string"
}
},
"required": [
"requestId",
"kind"
],
"additionalProperties": false,
"minProperties": 3,
"maxProperties": 4
},
"SearchSamplesResult": {
"type": "object",
"properties": {
"requestId": {
"type": "number"
},
"kind": {
"type": "string",
"enum": [
"success",
"fail"
]
},
"searchSampleResult": {
"type": "array",
"items": {
"$ref": "#/definitions/SampleFrame"
}
},
"error": {
"type": "string"
}
},
"required": [
"requestId",
"kind"
],
"additionalProperties": false,
"maxProperties": 3
},
"ResaveFailedLogsResult": {
"type": "object",
"properties": {
"requestId": {
"type": "number"
},
"kind": {
"type": "string",
"enum": [
"success",
"fail"
]
},
"savedCount": {
"type": "number"
},
"totalCount": {
"type": "number"
},
"error": {
"type": "string"
}
},
"required": [
"requestId",
"kind"
],
"additionalProperties": false,
"minProperties": 3,
"maxProperties": 4
},
"SampleFrame": {
"type": "object",
"properties": {
"time": {
"type": "string"
},
"samples": {
"type": "array",
"items": {
"$ref": "#/definitions/Sample"
}
}
},
"required": [
"time"
],
"additionalProperties": false
},
"FlowProtocol": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -327,6 +86,5 @@
],
"additionalProperties": false
}
},
"$ref": "#/definitions/FlowProtocol"
}
}
1 change: 1 addition & 0 deletions demo/match-debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"type": {
"kind": "string"
},
"entry": "team-schema.json",
"uniqueItems": true,
"minItems": 1
}
Expand Down
4 changes: 2 additions & 2 deletions demo/match-schema.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$ref": "#/definitions/Groups",
"definitions": {
"Groups": {
"type": "array",
Expand Down Expand Up @@ -85,6 +86,5 @@
"uniqueItems": true,
"minItems": 1
}
},
"$ref": "#/definitions/Groups"
}
}
1 change: 1 addition & 0 deletions demo/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type Match = {
};

/**
* @entry team-schema.json
* @uniqueItems
* @minItems 1
*/
Expand Down
Loading

0 comments on commit 65cd778

Please sign in to comment.