aboutsummaryrefslogtreecommitdiff
path: root/schemas_json/message.yaml
blob: 7f89ed306628a5102edc8a0c568ee96d5177c302 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
"$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:
                      oneOf:
                          - type: 'null'
                          - "$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
                  - entries
              properties:
                  type:
                      enum:
                          - log_entries
                  entries:
                      type: array
                      items:
                          "$ref": "hatter://message.yaml#/definitions/log_entry"
            - title: repositories
              type: object
              required:
                  - type
                  - repositories
              properties:
                  type:
                      enum:
                          - repositories
                  repositories:
                      type: array
                      items:
                          type: string

    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
...