Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/tmp/
/.DS_Store
/.rspec_status
/vendor/bundle/
24 changes: 24 additions & 0 deletions schemas/core/3.3.0/command_request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"title" : "CommandRequest",
"description" : "Command request - only single command (cCI) allowed per request",
"properties" : {
"mId" : { "$ref": "definitions.json#/message_id" },
"cId" : { "$ref": "definitions.json#/component_id" },
"arg" : {
"description" : "Command arguments",
"type" : "array",
"minItems": 1,
"items" : {
"type" : "object",
"properties": {
"cCI" : { "$ref": "definitions.json#/command_code" },
"n" : { "description" : "Unique reference of the value", "type" : "string" },
"cO" : { "description" : "Command", "type" : "string" },
"v" : { "description" : "Value" }
},
"required" : [ "cCI", "n", "cO", "v" ]
}
}
},
"required" : [ "mId", "cId", "arg"]
}
34 changes: 34 additions & 0 deletions schemas/core/3.3.0/command_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"title" : "CommandResponse",
"description" : "Command response - only single command (cCI) allowed per response",
"properties" : {
"mId" : { "$ref": "definitions.json#/message_id" },
"cId" : { "$ref": "definitions.json#/component_id" },
"cTS" : { "$ref": "definitions.json#/timestamp" },
"rvs" : {
"description" : "Command return values",
"type" : "array",
"items" : {
"type" : "object",
"properties": {
"cCI" : { "$ref": "definitions.json#/command_code" },
"n" : {
"description" : "Unique reference of the value",
"type" : "string"
},
"v" : {
"description" : "Value"
},
"age" : {
"description" : "Age of the value",
"type" : "string",
"enum" : [ "recent", "old", "undefined", "unknown" ]
}
},
"required" : [ "cCI", "n", "v", "age" ],
"additionalProperties": false
}
}
},
"required" : [ "mId", "cId", "cTS", "rvs" ]
}
93 changes: 93 additions & 0 deletions schemas/core/3.3.0/definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"message_id": {
"description" : "Message Id",
"type": "string",
"$comment" : "Example: 1.2.3 or 1.2",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
},
"timestamp" : {
"description" : "Timestamp",
"type": "string",
"$comment" : "Example: 2015-06-08T11:49:03.293Z",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
},
"integer" : {
"description" : "Integer as string",
"type": "string",
"$comment" : "Example: 123 or -123",
"pattern": "^\\-?[0-9]+$"
},
"number_as_string" : {
"description" : "Number as string",
"type": "string",
"$comment" : "Example: 123, -123, 0.5, -2.4",
"pattern": "^\\-?[0-9]+(\\.[0-9]+)?$"
},
"version": {
"description" : "Version",
"type": "string",
"$comment" : "Example: 1.2.3 or 1.2",
"pattern" : "^[0-9]{1,2}\\.[0-9]{1,2}(\\.[0-9]{1,2})?"
},
"command_code": {
"description" : "Command code id",
"type" : "string",
"pattern" : "^M"
},
"status_code": {
"description" : "Status code id",
"type" : "string",
"pattern" : "^S"
},
"alarm_code": {
"description" : "Alarm code id",
"type" : "string",
"pattern" : "^A"
},
"component_id": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not duplicate the entire definitions.json file, since and a few things changed. i suggest that this file only include the update definitions. then schema files can include both the old and this new one

"description" : "Component id - supports both format A (AA+BBCDD=EEEFFGGG) and format B (/component/path)",
"anyOf": [
{
"$comment": "Format A: Traditional component id like KK+AG0503=001DL001",
"type": "string",
"pattern": "^[A-Za-z0-9]+\\+[A-Za-z0-9]+=.+$"
},
{
"$comment": "Format B: Hierarchical component id like /sg/1 or /dl/radar/1",
"type": "string",
"pattern": "^(/[^/]+)+$",
"not": {
"pattern": "/$"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what uses cases does this cover, and why is it needed?

}
},
{
"$comment": "Empty string refers to main component",
"type": "string",
"enum": [""]
},
{
"$comment": "Null refers to main component",
"type": "null"
}
]
},
"boolean": {
"description" : "Boolean as string",
"type" : "string",
"enum" : [ "True", "False" ]
},
"integer_list": {
"description" : "Comma-separated list of integers as strings",
"type" : "string",
"pattern" : "^(\\-?\\d+)(?:,(\\-?\\d+))*$"
},
"boolean_list": {
"description" : "Comma-separated list of booleans as strings",
"type" : "string",
"pattern" : "^(True|False)(?:,(True|False))*$"
},
"string_list": {
"description" : "Comma-separated list of strings",
"type" : "string"
}
}
133 changes: 133 additions & 0 deletions schemas/core/3.3.0/rsmp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"allOf": [
{
"$ref": "../3.2.0/core.json"
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "MessageAck" } }
},
"then": {
"$ref": "../3.1.2/message_ack.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "MessageNotAck" } }
},
"then": {
"$ref": "../3.1.2/message_not_ack.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "Version" } }
},
"then": {
"$ref": "version.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "AggregatedStatus" } }
},
"then": {
"$ref": "../3.1.3/aggregated_status.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "AggregatedStatusRequest" } }
},
"then": {
"$ref": "../3.1.5/aggregated_status_request.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "Watchdog" } }
},
"then": {
"$ref": "../3.1.2/watchdog.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "Alarm" } }
},
"then": {
"$ref": "../3.2.0/alarm.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "CommandRequest" } }
},
"then": {
"$ref": "command_request.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "CommandResponse" } }
},
"then": {
"$ref": "command_response.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "StatusRequest" } }
},
"then": {
"$ref": "status_request.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "StatusResponse" } }
},
"then": {
"$ref": "../3.2.0/status_response.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "StatusSubscribe" } }
},
"then": {
"$ref": "status_subscribe.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "StatusUnsubscribe" } }
},
"then": {
"$ref": "../3.1.2/status_unsubscribe.json"
}
},
{
"if": {
"required" : ["type"],
"properties": { "type": { "const": "StatusUpdate" } }
},
"then": {
"$ref": "../3.2.0/status_update.json"
}
}
]
}
21 changes: 21 additions & 0 deletions schemas/core/3.3.0/status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"properties" : {
"mId" : { "$ref": "definitions.json#/message_id" },
"cId" : { "$ref": "definitions.json#/component_id" },
"sS" : {
"description" : "Status request arguments",
"type" : "array",
"minItems": 1,
"items" : {
"type" : "object",
"properties": {
"sCI" : { "$ref": "definitions.json#/status_code" },
"n" : { "description" : "Unique reference of the value", "type" : "string" }
},
"required" : [ "sCI", "n" ],
"additionalProperties": false
}
}
},
"required" : [ "mId", "cId", "sS"]
}
5 changes: 5 additions & 0 deletions schemas/core/3.3.0/status_request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title" : "StatusRequest",
"description" : "Status request",
"$ref": "status.json"
}
31 changes: 31 additions & 0 deletions schemas/core/3.3.0/status_subscribe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"title" : "StatusSubscribe",
"description" : "Status subscribe",
"properties" : {
"mId" : { "$ref": "definitions.json#/message_id" },
"cId" : { "$ref": "definitions.json#/component_id" },
"sS" : {
"description" : "Status request arguments",
"type" : "array",
"minItems": 1,
"items" : {
"type" : "object",
"properties": {
"sCI" : { "$ref": "definitions.json#/status_code" },
"n" : { "description" : "Unique reference of the value", "type" : "string" },
"uRt" : {
"$ref": "definitions.json#/number_as_string",
"description" : "Update interval in seconds, 0 means send when value changes"
},
"sOc" : {
"type": "boolean",
"description" : "Whether to send an update as soon as the value changes"
}
},
"required" : [ "sCI", "n", "uRt", "sOc" ],
"additionalProperties": false
}
}
},
"required" : [ "mId", "cId", "sS"]
}
Loading
Loading