cadmium-docs-legacy/protocol-spec/json-schema/BaseMessage.schema.json
2019-12-15 18:35:55 +04:00

68 lines
2.2 KiB
JSON

{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "urn:cadmium:0",
"type": "object",
"title": "Base Message Schema",
"required": [
"id",
"type",
"from",
"to",
"payload"
],
"additionalProperties": false,
"properties": {
"id": {
"$id": "#/properties/id",
"type": "string",
"title": "id",
"description": "Message identifier (used to track the request-response chain)",
"examples": [
"abcd"
]
},
"type": {
"$id": "#/properties/type",
"type": "string",
"title": "type",
"description": "Type of message (used to determine which extension this message belongs to)",
"examples": [
"profile:register",
"profile:login",
"incorrectMessageType:error"
]
},
"from": {
"$id": "#/properties/from",
"type": "string",
"title": "from",
"description": "From which entity this message is send. May be set to \"anonymous\" value, if action doesn't require authorization. This is EntityID",
"examples": [
"396277b7dcd0f1173f2007baa604de7593529cc3fbf335fb7924851cb25c1fdf",
"@juliet@396277b7dcd0f1173f2007baa604de7593529cc3fbf335fb7924851cb25c1fdf",
"#chpok@b9966d89028b120145dad38961bed0b3b2eac0a2915c0bb1665ffcc1586f6f59",
"anonymous"
]
},
"to": {
"$id": "#/properties/to",
"type": "string",
"title": "to",
"description": "Message recipient. This is Entity ID.",
"examples": [
"@juliet@02a6f23250868e903ff62e99e664a5717e945ca8153bf0ebc4f505cbe3a0860c",
"#white_house_garden@8baef2426dc6a92e16d39d79d90ae6d5a0080aaeccc5f02f1e83a959bc4d0be7",
"%phone:1234567890@6dfea40d98f71b3191f94c31af887a00eaeef2fe3501226e3fbb302fc5269eec",
"@romeo@cadmium.im"
]
},
"payload": {
"$id": "#/properties/payload",
"type": "object",
"title": "payload",
"description": "Message payload (used to store extra information in message, list of permissible fields in the payload depends on \"type\" field)"
}
}
}