common.json 4.23 KB
Newer Older
1
2
3
4
5
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Algorithm common components descriptor",
  "description": "This schema defines the components used in one or more versions of the Algorithm",

6
  "definitions": {
7

8
9
10
11
12
13
14
15
16
17
18
19
    "endpoint": {
      "type": "object",
      "properties": {
        "type": { "$ref": "../common/1.json#/definitions/reference" },
        "description": { "type": "string" }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false
    },

20
21
22
23
    "endpoints": {
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z_][a-zA-Z0-9_-]*$": {
24
          "$ref": "#/definitions/endpoint"
25
26
27
        }
      },
      "uniqueItems": true,
28
29
      "additionalProperties": false,
      "minProperties": 1
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    },

    "io_group": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "inputs": { "$ref": "#/definitions/endpoints" },
        "outputs": { "$ref": "#/definitions/endpoints" }
      },
      "required": [
        "inputs",
        "outputs"
      ],
      "additionalProperties": false
    },

    "input_group": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "inputs": { "$ref": "#/definitions/endpoints" }
      },
      "required": [
        "inputs"
      ],
      "additionalProperties": false
    },

    "block_groups": {
      "type": "array",
      "items": [
        { "$ref": "#/definitions/io_group" }
      ],
      "additionalItems": { "$ref": "#/definitions/input_group" },
      "minItems": 1
    },

    "range": {
      "type": "array",
      "items": { "$ref": "../common/1.json#/definitions/value" },
      "minItems": 2,
      "maxItems": 2
    },

    "choice": {
      "type": "array",
      "items": { "$ref": "../common/1.json#/definitions/value" },
      "minItems": 3
    },

    "parameter": {
      "type": "object",
      "properties": {
        "type": { "$ref": "../common/1.json#/definitions/basetype" },
        "default": { "$ref": "../common/1.json#/definitions/value" },
        "description": { "type": "string" }
      },
      "required": [
        "type"
      ]
    },

    "range_parameter": {
      "allOf": [
        { "$ref": "#/definitions/parameter" },
        {
          "properties": {
            "range": { "$ref": "#/definitions/range" }
          },
          "required": [
            "range"
          ]
        }
      ],
      "additionalProperties": false
    },

    "choice_parameter": {
      "allOf": [
        { "$ref": "#/definitions/parameter" },
        {
          "properties": {
            "range": { "$ref": "#/definitions/choice" }
          },
          "required": [
            "choice"
          ]
        }
      ],
      "additionalProperties": false
    },

    "parameters": {
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z_][a-zA-Z0-9_-]*$": {
          "oneOf": [
            { "$ref": "#/definitions/parameter" },
            { "$ref": "#/definitions/range_parameter" },
            { "$ref": "#/definitions/choice_parameter" }
          ]
        }
      },
      "uniqueItems": true,
      "additionalProperties": false
    },

    "analyzer_groups": {
      "type": "array",
      "items": { "$ref": "#/definitions/input_group" },
      "minItems": 1
    },

    "resulttype": {
      "oneOf": [
        { "type": "string", "enum": [ "int32", "float32", "bool", "string" ] },
        { "type": "string", "pattern": "^system/[a-zA-Z0-9_-]+/[0-9]+$" },
        { "type": "string", "pattern": "^plot/[a-zA-Z0-9_-]+/[0-9]+$" }
      ]
    },

    "result": {
      "type": "object",
      "properties": {
        "type": { "$ref": "#/definitions/resulttype" },
        "display": { "type": "boolean" },
        "description": { "type": "string" }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false
    },

    "results": {
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z_][a-zA-Z0-9_-]*$": {
          "$ref": "#/definitions/result"
        }
      },
      "uniqueItems": true,
172
173
      "additionalProperties": false,
      "minProperties": 1
174
175
176
177
178
    },

    "schema_version": { "$ref": "../common/1.json#/definitions/version" },
    "api_version": { "$ref": "../common/1.json#/definitions/version" }
  }
179
}