Update DCAE Committer in INFO.yaml
[dcaegen2/platform/cli.git] / component-json-schemas / component-specification / dcae-cli-v1 / component-spec-schema.json
1 {
2   "$schema": "http://json-schema.org/draft-04/schema#",
3   "title": "Component specification schema",
4   "type": "object",
5   "properties": {
6     "self": {
7       "type": "object",
8       "properties": {
9         "version": {
10           "$ref": "#/definitions/version"
11         },
12         "description": {
13           "type": "string"
14         },
15         "component_type": {
16           "type": "string",
17           "enum": [
18             "docker",
19             "cdap"
20           ]
21         },
22         "name": {
23           "$ref": "#/definitions/name"
24         }
25       },
26       "required": [
27         "version",
28         "name",
29         "description",
30         "component_type"
31       ]
32     },
33     "streams": {
34       "type": "object",
35       "properties": {
36         "publishes": {
37           "type": "array",
38           "uniqueItems": true,
39           "items": {
40             "oneOf": [
41                 { "$ref": "#/definitions/publisher_http" },
42                 { "$ref": "#/definitions/publisher_message_router" },
43                 { "$ref": "#/definitions/publisher_data_router" }
44             ]
45           }
46         },
47         "subscribes": {
48           "type": "array",
49           "uniqueItems": true,
50           "items": {
51             "oneOf": [
52                 { "$ref": "#/definitions/subscriber_http" },
53                 { "$ref": "#/definitions/subscriber_message_router" },
54                 { "$ref": "#/definitions/subscriber_data_router" }
55             ]
56           }
57         }
58       },
59       "required": [
60         "publishes",
61         "subscribes"
62       ]
63     },
64     "services": {
65       "type": "object",
66       "properties": {
67         "calls": {
68           "type": "array",
69           "uniqueItems": true,
70           "items": {
71             "$ref": "#/definitions/caller"
72           }
73         },
74         "provides": {
75           "type": "array",
76           "uniqueItems": true,
77           "items": {
78             "$ref": "#/definitions/provider"
79           }
80         }
81       },
82       "required": [
83         "calls",
84         "provides"
85       ]
86     },
87    "parameters" : {
88       "anyOf" : [
89         {"$ref": "#/definitions/docker-parameters"},
90         {"$ref": "#/definitions/cdap-parameters"}
91       ]
92     },
93     "auxilary": {
94       "oneOf" : [
95         {"$ref": "#/definitions/auxilary_cdap"},
96         {"$ref": "#/definitions/auxilary_docker"}
97       ]
98     },
99     "artifacts": {
100       "type": "array",
101       "description": "List of component artifacts",
102       "items": {
103         "$ref": "#/definitions/artifact"
104       }
105     }
106   },
107   "required": [
108     "self",
109     "streams",
110     "services",
111     "parameters",
112     "auxilary",
113     "artifacts"
114   ],
115   "additionalProperties": false,
116   "definitions": {
117     "cdap-parameters": {
118       "description" : "There are three seperate ways to pass parameters to CDAP: app config, app preferences, program preferences. These are all treated as optional.",
119       "type": "object",
120       "properties" : {
121         "program_preferences": {
122           "description" : "A list of {program_id, program_type, program_preference} objects where program_preference is an object passed into program_id of type program_type",
123           "type": "array",
124           "uniqueItems": true,
125           "items": {
126             "$ref": "#/definitions/program_preference"
127           }
128         },
129         "app_preferences" : {
130           "description" : "Parameters Passed down to the CDAP preference API",
131           "type": "array",
132             "uniqueItems": true,
133             "items": {
134               "$ref": "#/definitions/parameter"
135             }
136         },
137         "app_config" : {
138           "description" : "Parameters Passed down to the CDAP App Config",
139           "type": "array",
140             "uniqueItems": true,
141             "items": {
142               "$ref": "#/definitions/parameter"
143             }
144         }
145       }
146     },
147     "program_preference": {
148       "type": "object",
149       "properties": {
150         "program_type": {
151           "$ref": "#/definitions/program_type"
152         },
153         "program_id": {
154           "type": "string"
155         },
156         "program_pref":{
157           "description" : "Parameters that the CDAP developer wants pushed to this program's preferences API. Optional",
158             "type": "array",
159             "uniqueItems": true,
160             "items": {
161               "$ref": "#/definitions/parameter"
162             }
163         }
164       },
165       "required": ["program_type", "program_id", "program_pref"]
166     },
167     "program_type": {
168       "type": "string",
169       "enum": ["flows","mapreduce","schedules","spark","workflows","workers","services"]
170     },
171     "docker-parameters": {
172       "type": "array",
173       "uniqueItems": true,
174       "items": {
175         "$ref": "#/definitions/parameter"
176       }
177     },
178     "parameter": {
179       "type": "object",
180       "properties": {
181         "name": {
182           "type": "string"
183         },
184         "value": {
185           "description": "Default value for the parameter"
186         },
187         "description": {
188           "description": "Description for the parameter.",
189           "type": "string"
190         },
191         "type": {
192           "description": "The required data type for the parameter.",
193           "type": "string",
194           "enum": [ "string", "number", "boolean", "datetime" ]
195         },
196         "required": {
197           "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.",
198           "type": "boolean",
199           "default": true
200         },
201         "constraints": {
202           "description": "The optional list of sequenced constraint clauses for the parameter.",
203           "type": "array",
204           "items": {
205             "$ref": "#/definitions/parameter-constraints"
206           }
207         },
208         "entry_schema": {
209             "description": "used for complex data type in the future. 'type' must be map or array for entry_schema to kick_in. ",
210             "type": "string"
211         },
212         "designer_editable": {
213           "description": "An optional key that declares a parameter to be editable by designer (true) or not (false). Default is true.",
214           "type": "boolean",
215           "default": true
216         },
217         "policy_editable": {
218           "description": "An optional key that declares a parameter to be editable by policy (true) or not (false). Default is true.",
219           "type": "boolean",
220           "default": false
221         },
222         "sourced_at_deployment": {
223           "description": "An optional key that declares a parameter's value to be assigned at deployment time (true). Default is false.",
224           "type": "boolean",
225           "default": false
226         },
227         "policy_schema" :{
228           "type": "array",
229           "uniqueItems": true,
230           "items": {"$ref": "#/definitions/policy_schema_parameter"}
231         }
232       },
233       "required": [
234         "name",
235         "value",
236         "description"
237       ],
238       "additionalProperties": false,
239       "dependencies": { "policy_schema": ["policy_editable"]}
240     },
241     "policy_schema_parameter": {
242         "type": "object",
243         "properties": {
244             "name": {
245                 "type": "string"
246             },
247             "value": {
248                 "description": "Default value for the parameter"
249             },
250             "description": {
251                 "description": "Description for the parameter.",
252                 "type": "string"
253             },
254             "type": {
255                 "description": "The required data type for the parameter.",
256                 "type": "string",
257                 "enum": [ "string", "number", "boolean", "datetime", "list", "map" ]
258             },
259             "required": {
260                 "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.",
261                 "type": "boolean",
262                 "default": true
263             },
264             "constraints": {
265                 "description": "The optional list of sequenced constraint clauses for the parameter.",
266                 "type": "array",
267                 "items": {
268                     "$ref": "#/definitions/parameter-constraints"
269                 }
270             },
271             "entry_schema": {
272                 "description": "The optional key that is used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is either list or map. If the type is list and the entry type is a simple type (string, number, boolean, datetime), follow with a simple string to describe the entry type. If the type is list and the entry type is a map, follow with an array to describe the keys for the entry map. If the type is list and the entry type is also list, this is not currently supported here. If the type is map, then follow with an array to describe the keys for this map. ",
273                 "type": "array", "uniqueItems": true, "items": {"$ref": "#/definitions/policy_schema_parameter"}
274             }
275        },
276         "required": [
277             "name",
278             "type"
279             ],
280       "additionalProperties": false
281     },
282     "parameter-constraints": {
283       "type": "object",
284       "additionalProperties": false,
285       "properties": {
286         "equal": {
287           "description": "Constrains a property or parameter to a value equal to (‘=’) the value declared."
288         },
289         "greater_than": {
290           "description": "Constrains a property or parameter to a value greater than (‘>’) the value declared.",
291           "type": "number"
292         },
293         "greater_or_equal": {
294           "description": "Constrains a property or parameter to a value greater than or equal to (‘>=’) the value declared.",
295           "type": "number"
296         },
297         "less_than": {
298           "description": "Constrains a property or parameter to a value less than (‘<’) the value declared.",
299           "type": "number"
300         },
301         "less_or_equal": {
302           "description": "Constrains a property or parameter to a value less than or equal to (‘<=’) the value declared.",
303           "type": "number"
304         },
305         "valid_values": {
306           "description": "Constrains a property or parameter to a value that is in the list of declared values.",
307           "type": "array"
308         },
309         "length": {
310           "description": "Constrains the property or parameter to a value of a given length.",
311           "type": "number"
312         },
313         "min_length": {
314           "description": "Constrains the property or parameter to a value to a minimum length.",
315           "type": "number"
316         },
317         "max_length": {
318           "description": "Constrains the property or parameter to a value to a maximum length.",
319           "type": "number"
320         }
321       }
322     },
323     "stream_message_router": {
324       "type": "object",
325       "properties": {
326         "format": {
327           "$ref": "#/definitions/name"
328         },
329         "version": {
330           "$ref": "#/definitions/version"
331         },
332         "config_key": {
333           "type": "string"
334         },
335         "type": {
336           "description": "Type of stream to be used",
337           "type": "string",
338           "enum": [
339             "message router", "message_router"
340           ]
341         }
342       },
343       "required": [
344         "format",
345         "version",
346         "config_key",
347         "type"
348       ]
349     },
350     "publisher_http": {
351       "type": "object",
352       "properties": {
353         "format": {
354           "$ref": "#/definitions/name"
355         },
356         "version": {
357           "$ref": "#/definitions/version"
358         },
359         "config_key": {
360           "type": "string"
361         },
362         "type": {
363           "description": "Type of stream to be used",
364           "type": "string",
365           "enum": [
366             "http",
367             "https"
368           ]
369         }
370       },
371       "required": [
372         "format",
373         "version",
374         "config_key",
375         "type"
376       ]
377     },
378     "publisher_message_router": {
379       "$ref": "#/definitions/stream_message_router"
380     },
381     "publisher_data_router": {
382       "type": "object",
383       "properties": {
384         "format": {
385           "$ref": "#/definitions/name"
386         },
387         "version": {
388           "$ref": "#/definitions/version"
389         },
390         "config_key": {
391           "type": "string"
392         },
393         "type": {
394           "description": "Type of stream to be used",
395           "type": "string",
396           "enum": [
397             "data router", "data_router"
398           ]
399         }
400       },
401       "required": [
402         "format",
403         "version",
404         "config_key",
405         "type"
406       ]
407     },
408     "subscriber_http": {
409       "type": "object",
410       "properties": {
411         "format": {
412           "$ref": "#/definitions/name"
413         },
414         "version": {
415           "$ref": "#/definitions/version"
416         },
417         "route": {
418           "type": "string"
419         },
420         "type": {
421           "description": "Type of stream to be used",
422           "type": "string",
423           "enum": [
424             "http",
425             "https"
426           ]
427         }
428       },
429       "required": [
430         "format",
431         "version",
432         "route",
433         "type"
434       ]
435     },
436     "subscriber_message_router": {
437       "$ref": "#/definitions/stream_message_router"
438     },
439     "subscriber_data_router": {
440       "type": "object",
441       "properties": {
442         "format": {
443           "$ref": "#/definitions/name"
444         },
445         "version": {
446           "$ref": "#/definitions/version"
447         },
448         "route": {
449           "type": "string"
450         },
451         "type": {
452           "description": "Type of stream to be used",
453           "type": "string",
454           "enum": [
455             "data router", "data_router"
456           ]
457         },
458         "config_key": {
459           "description": "Data router subscribers require config info to setup their endpoints to handle requests. For example, needs username and password",
460           "type": "string"
461         }
462       },
463       "required": [
464         "format",
465         "version",
466         "route",
467         "type",
468         "config_key"
469       ]
470     },
471     "provider" : {
472       "oneOf" : [
473         {"$ref": "#/definitions/docker-provider"},
474         {"$ref": "#/definitions/cdap-provider"}
475       ]
476     },
477     "cdap-provider" : {
478       "type": "object",
479       "properties" : {
480          "request": {
481            "$ref": "#/definitions/formatPair"
482          },
483          "response": {
484            "$ref": "#/definitions/formatPair"
485          },
486          "service_name" : {
487            "type" : "string"
488          },
489          "service_endpoint" : {
490            "type" : "string"
491          },
492          "verb" : {
493            "type": "string",
494            "enum": ["GET", "PUT", "POST", "DELETE"]
495         }
496       },
497       "required" : [
498         "request", 
499         "response",
500         "service_name",
501         "service_endpoint",
502         "verb"
503         ]
504     },
505     "docker-provider": {
506       "type": "object",
507       "properties": {
508         "request": {
509           "$ref": "#/definitions/formatPair"
510         },
511         "response": {
512           "$ref": "#/definitions/formatPair"
513         },
514         "route": {
515           "type": "string"
516         },
517         "verb": {
518           "type": "string",
519           "enum": ["GET", "PUT", "POST", "DELETE"]
520         }
521       },
522       "required": [
523         "request",
524         "response",
525         "route"
526       ]
527     },
528     "caller": {
529       "type": "object",
530       "properties": {
531         "request": {
532           "$ref": "#/definitions/formatPair"
533         },
534         "response": {
535           "$ref": "#/definitions/formatPair"
536         },
537         "config_key": {
538           "type": "string"
539         }
540       },
541       "required": [
542         "request",
543         "response",
544         "config_key"
545       ]
546     },
547     "formatPair": {
548       "type": "object",
549       "properties": {
550         "format": {
551           "$ref": "#/definitions/name"
552         },
553         "version": {
554           "$ref": "#/definitions/version"
555         }
556       }
557     },
558     "name": {
559       "type": "string"
560     },
561     "version": {
562       "type": "string",
563       "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$"
564     },
565     "artifact": {
566       "type": "object",
567       "description": "Component artifact object",
568       "properties": {
569         "uri": {
570           "type": "string",
571           "description": "Uri to artifact"
572         },
573         "type": {
574           "type": "string",
575           "enum": ["jar", "docker image"]
576         }
577       },
578       "required": ["uri", "type"]
579     },
580
581     "auxilary_cdap": {
582       "title": "cdap component specification schema",
583       "type": "object",
584       "properties": {
585         "streamname": {
586           "type": "string"
587         },
588         "artifact_name" : {
589           "type": "string"
590         },
591         "artifact_version" : {
592           "type": "string",
593           "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$"
594         },
595         "namespace":{
596           "type": "string",
597           "description" : "optional"
598         },
599         "programs": {
600           "type": "array",
601           "uniqueItems": true,
602           "items": {
603             "$ref": "#/definitions/cdap_program"
604           }
605         }
606       },
607       "required": [
608         "streamname",
609         "programs",
610         "artifact_name",
611         "artifact_version"
612       ]
613     },
614     "cdap_program_type": {
615       "type": "string",
616       "enum": ["flows","mapreduce","schedules","spark","workflows","workers","services"]
617     },
618     "cdap_program": {
619       "type": "object",
620       "properties": {
621         "program_type": {
622           "$ref": "#/definitions/cdap_program_type"
623         },
624         "program_id": {
625           "type": "string"
626         }
627       },
628       "required": ["program_type", "program_id"]
629     },
630
631     "auxilary_docker": {
632       "title": "Docker component specification schema",
633       "type": "object",
634       "properties": {
635         "healthcheck": {
636           "description": "Define the health check that Consul should perfom for this component",
637           "type": "object",
638           "oneOf": [
639             { "$ref": "#/definitions/docker_healthcheck_http" },
640             { "$ref": "#/definitions/docker_healthcheck_script" }
641           ]
642         },
643         "ports": {
644           "description": "Port mapping to be used for Docker containers. Each entry is of the format <container port>:<host port>.",
645           "type": "array",
646           "items": {
647             "type": "string"
648           }
649         }
650       },
651       "required": [
652         "healthcheck"
653       ],
654       "additionalProperties": false
655     },
656     "docker_healthcheck_http": {
657       "properties": {
658         "type": {
659           "description": "Consul health check type",
660           "type": "string",
661           "enum": [
662             "http",
663             "https"
664           ]
665         },
666         "interval": {
667           "description": "Interval duration in seconds i.e. 10s",
668           "default": "15s",
669           "type": "string"
670         },
671         "timeout": {
672           "description": "Timeout in seconds i.e. 10s",
673           "default": "1s",
674           "type": "string"
675         },
676         "endpoint": {
677           "description": "Relative endpoint used by Consul to check health by making periodic HTTP GET calls",
678           "type": "string"
679         }
680       },
681       "required": [
682         "type",
683         "endpoint"
684         ]
685     },
686     "docker_healthcheck_script": {
687       "properties": {
688         "type": {
689           "description": "Consul health check type",
690           "type": "string",
691           "enum": [
692             "script",
693             "docker"
694           ]
695         },
696         "interval": {
697           "description": "Interval duration in seconds i.e. 10s",
698           "default": "15s",
699           "type": "string"
700         },
701         "timeout": {
702           "description": "Timeout in seconds i.e. 10s",
703           "default": "1s",
704           "type": "string"
705         },
706         "script": {
707           "description": "Script command that will be executed by Consul to check health",
708           "type": "string"
709         }
710       },
711       "required": [
712         "type",
713         "script"
714         ]
715     }
716   }
717 }