From 8fc558c5508a0a052f58f2ca2c8131d86a134ca3 Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Tue, 22 Aug 2017 16:40:31 +0200 Subject: json schemas --- README.rst | 3 +- schemas_json/message.yaml | 114 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 schemas_json/message.yaml diff --git a/README.rst b/README.rst index 60eb227..89db1c4 100644 --- a/README.rst +++ b/README.rst @@ -68,8 +68,6 @@ TODO * web server - backend - * JSON Schema describing messages used in communication between backend and - frontend * implement functionality provided by internal communication protocol * user interface - frontend @@ -79,5 +77,6 @@ TODO * other + * test functionality * write complete setup.py * distribution diff --git a/schemas_json/message.yaml b/schemas_json/message.yaml new file mode 100644 index 0000000..0c79507 --- /dev/null +++ b/schemas_json/message.yaml @@ -0,0 +1,114 @@ +--- +"$schema": "http://json-schema.org/schema#" +id: "hatter://message.yaml#" +title: Message +description: Backend-frontend communication messages +oneOf: + - "$ref": "hatter://message.yaml#/definitions/client_message" + - "$ref": "hatter://message.yaml#/definitions/server_message" +definitions: + client_message: + title: Client message + description: Message sent by frontend + oneOf: + - title: Set log + type: object + required: + - type + - offset + - limit + properties: + type: + enum: + - set_log + offset: + type: integer + limit: + type: integer + - title: Add job + type: object + required: + - type + - repository + - commit + properties: + type: + enum: + - add_job + repository: + type: string + commit: + type: string + server_message: + title: Server message + description: Message sent by backend + oneOf: + - title: Active job + type: object + required: + - type + - job + properties: + type: + enum: + - active_job + job: + "$ref": "hatter://message.yaml#/definitions/job" + - title: Job queue + type: object + required: + - type + - jobs + properties: + type: + enum: + - job_queue + jobs: + type: array + items: + "$ref": "hatter://message.yaml#/definitions/job" + - title: Log entries + type: object + required: + - type + properties: + type: + enum: + - log_entries + entries: + type: array + items: + "$ref": "hatter://message.yaml#/definitions/log_entry" + job: + type: object + required: + - id + - timestamp + - repository + - commit + properties: + id: + type: integer + timestamp: + type: integer + repository: + type: string + commit: + type: string + log_entry: + type: object + required: + - timestamp + - repository + - commit + - message + properties: + timestamp: + type: integer + repository: + type: string + commit: + type: string + message: + type: string +... -- cgit v1.2.3-70-g09d2