From 4e0c4b1d115118d1c5024697b806d1e169b038dd Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Mon, 16 Dec 2019 17:14:18 +0400 Subject: [PATCH] Correct Protocol Errors extension - add ok variable --- protocol-spec/json-schema/BaseMessage.schema.json | 6 ++++++ protocol-spec/protocol-errors.md | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/protocol-spec/json-schema/BaseMessage.schema.json b/protocol-spec/json-schema/BaseMessage.schema.json index 30ce414..343b1db 100644 --- a/protocol-spec/json-schema/BaseMessage.schema.json +++ b/protocol-spec/json-schema/BaseMessage.schema.json @@ -62,6 +62,12 @@ "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)" + }, + "ok": { + "$id": "#/properties/ok", + "type": "boolean", + "title": "ok", + "description": "Indicating whether request have an error" } } } diff --git a/protocol-spec/protocol-errors.md b/protocol-spec/protocol-errors.md index a9c52c3..159e18f 100644 --- a/protocol-spec/protocol-errors.md +++ b/protocol-spec/protocol-errors.md @@ -1,7 +1,7 @@ # Protocol Errors ## Introduction Mechanism of error processing included into protocol. -Adds into any type ID `:error` postfix. +Adds into any response message `ok` variable. If `ok` is true - we have no errors, if `ok` is false - we have an error. ## Message type identifiers - `*:error` @@ -24,9 +24,10 @@ Adds into any type ID `:error` postfix. ```json { "id": "abcd", - "type": "incorrectMessageType:error", + "type": "incorrectMessageType", "from": "cadmium.im", "to": "@juliet@cadmium.im", + "ok": false, "payload": { "errCode": 0, "errText": "Incorrect type of message (type isn't implemented in the server)",