Skip to content

Commit c47a9c0

Browse files
committed
Use jsonschema Draft3Validator
Most of Linux distribution does not have jsonschema version that supports Draft7Validator. So switch back to Draft3Validator to make it easier to install Wok. Signed-off-by: Aline Manera <[email protected]>
1 parent e7c5fca commit c47a9c0

File tree

1 file changed

+30
-54
lines changed

1 file changed

+30
-54
lines changed

API.json

+30-54
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "http://json-schema.org/draft-07/schema#",
2+
"$schema": "http://json-schema.org/draft-03/schema#",
33
"title": "Kimchi API",
44
"description": "Json schema for Kimchi API",
55
"type": "object",
@@ -15,7 +15,7 @@
1515
},
1616
"listen": {
1717
"error": "KCHVM0015E",
18-
"anyOf": [
18+
"type": [
1919
{
2020
"type": "string",
2121
"format": "ipv4"
@@ -94,27 +94,25 @@
9494
"interface": {
9595
"description": "Host network interface. This indicates how to configure the host network interface (Ethernet, Bond, VLAN) as direct macvtap or as OVS interface to a VM.",
9696
"type": "object",
97-
"required": [
98-
"type",
99-
"name"
100-
],
10197
"properties": {
10298
"type": {
103-
"description": "Host network interface type. Valid types are: 'macvtap' for host network interface (Ethernet, Bond, VLAN) to be connected as direct MacVTap or 'ovs' for openvswitch host network interface to be connected as virtual switch to a VM.",
104-
"type": "string",
105-
"pattern": "^(macvtap|ovs)$",
106-
"error": "KCHTMPL0034E"
99+
"description": "Host network interface type. Valid types are: 'macvtap' for host network interface (Ethernet, Bond, VLAN) to be connected as direct MacVTap or 'ovs' for openvswitch host network interface to be connected as virtual switch to a VM.",
100+
"type": "string",
101+
"required": true,
102+
"pattern": "^(macvtap|ovs)$",
103+
"error": "KCHTMPL0034E"
107104
},
108105
"name": {
109-
"description": "The host network interface name. It should be name of host network interface(Ethernet, Bond, VLAN) for type 'macvtap' and name of host openvswitch bridge interface for type ovs",
110-
"type": "string",
111-
"error": "KCHTMPL0035E"
106+
"description": "The host network interface name. It should be name of host network interface(Ethernet, Bond, VLAN) for type 'macvtap' and name of host openvswitch bridge interface for type ovs",
107+
"type": "string",
108+
"required": true,
109+
"error": "KCHTMPL0035E"
112110
},
113111
"mode": {
114-
"description": "Only applicable for macvtap interface type. That indicates whether packets will be delivered directly to target device (bridge) or to the external bridge (vepa-capable bridge).",
115-
"type": "string",
116-
"pattern": "^(bridge|vepa)$",
117-
"error": "KCHTMPL0036E"
112+
"description": "Only applicable for macvtap interface type. That indicates whether packets will be delivered directly to target device (bridge) or to the external bridge (vepa-capable bridge).",
113+
"type": "string",
114+
"pattern": "^(bridge|vepa)$",
115+
"error": "KCHTMPL0036E"
118116
}
119117
},
120118
"additionalProperties": false,
@@ -124,22 +122,20 @@
124122
"properties": {
125123
"storagepools_create": {
126124
"type": "object",
127-
"required": [
128-
"name",
129-
"type"
130-
],
131125
"error": "KCHPOOL0026E",
132126
"properties": {
133127
"name": {
134128
"description": "The name of the Storage Pool",
135129
"type": "string",
130+
"required": true,
136131
"minLength": 1,
137132
"pattern": "^[^/]*$",
138133
"error": "KCHPOOL0016E"
139134
},
140135
"type": {
141136
"description": "The type of the defined Storage Pool",
142137
"type": "string",
138+
"required": true,
143139
"pattern": "^dir|netfs|logical|kimchi-iso|iscsi|scsi$",
144140
"error": "KCHPOOL0017E"
145141
},
@@ -275,28 +271,23 @@
275271
},
276272
"storagevolume_update": {
277273
"type": "object",
278-
"required": [
279-
"chunk",
280-
"chunk_size"
281-
],
282274
"properties": {
283275
"chunk": {
284276
"description": "Upload storage volume chunk",
285-
"error": "KCHVOL0024E"
277+
"error": "KCHVOL0024E",
278+
"required": true
286279
},
287280
"chunk_size": {
288281
"description": "Chunk size of uploaded storage volume",
289282
"type": "string",
283+
"required": true,
290284
"error": "KCHVOL0024E"
291285
}
292286
},
293287
"additionalProperties": false
294288
},
295289
"vms_create": {
296290
"type": "object",
297-
"required": [
298-
"template"
299-
],
300291
"error": "KCHVM0016E",
301292
"properties": {
302293
"name": {
@@ -319,6 +310,7 @@
319310
"description": "The URI of a template to use when building a VM",
320311
"type": "string",
321312
"pattern": "^/plugins/kimchi/templates/(.*?)/?$",
313+
"required": true,
322314
"error": "KCHVM0012E"
323315
},
324316
"storagepool": {
@@ -439,14 +431,12 @@
439431
},
440432
"vm_migrate": {
441433
"type": "object",
442-
"required": [
443-
"remote_host"
444-
],
445434
"properties": {
446435
"remote_host": {
447436
"description": "IP address or hostname of the remote server",
448437
"type": "string",
449438
"minLength": 1,
439+
"required": true,
450440
"error": "KCHVM0060E"
451441
},
452442
"user": {
@@ -470,22 +460,20 @@
470460
},
471461
"networks_create": {
472462
"type": "object",
473-
"required": [
474-
"name",
475-
"connection"
476-
],
477463
"error": "KCHNET0016E",
478464
"properties": {
479465
"name": {
480466
"description": "The name of the new network",
481467
"type": "string",
482468
"minLength": 1,
469+
"required": true,
483470
"pattern": "^[^/\"]*$",
484471
"error": "KCHNET0011E"
485472
},
486473
"connection": {
487474
"description": "Specifies how this network should be connected to the other networks",
488475
"type": "string",
476+
"required": true,
489477
"pattern": "^isolated|nat|bridge|macvtap|vepa|passthrough$",
490478
"error": "KCHNET0012E"
491479
},
@@ -542,14 +530,12 @@
542530
},
543531
"vmifaces_create": {
544532
"type": "object",
545-
"required": [
546-
"type"
547-
],
548533
"error": "KCHVMIF0007E",
549534
"properties": {
550535
"type": {
551536
"description": "The type of VM network interface that libvirt supports. Type 'macvtap' for host network interface (Ethernet, Bond, VLAN) to be connected as direct MacVTap or 'ovs' for openvswitch host network interface to be connected as virtual switch to a VM or 'network' for libvirt virtual network to be connected to VM. ",
552537
"type": "string",
538+
"required": true,
553539
"pattern": "^network|macvtap|ovs$",
554540
"error": "KCHVMIF0004E"
555541
},
@@ -597,9 +583,6 @@
597583
},
598584
"templates_create": {
599585
"type": "object",
600-
"required": [
601-
"source_media"
602-
],
603586
"error": "KCHTMPL0016E",
604587
"properties": {
605588
"name": {
@@ -630,12 +613,11 @@
630613
"memory": { "$ref": "#/kimchitype/memory" },
631614
"source_media": {
632615
"type" : "object",
633-
"required": [
634-
"type"
635-
],
616+
"required": true,
636617
"properties" : {
637618
"type": {
638619
"description": "Type of source media: disk or netboot",
620+
"required": true,
639621
"type": "string",
640622
"pattern": "^disk|netboot$"
641623
},
@@ -747,15 +729,13 @@
747729
},
748730
"vmstorages_create": {
749731
"type": "object",
750-
"required": [
751-
"type"
752-
],
753732
"error": "KCHVMSTOR0012E",
754733
"properties": {
755734
"type": {
756735
"description": "The storage type",
757736
"type": "string",
758737
"pattern": "^cdrom|disk$",
738+
"required": true,
759739
"error": "KCHVMSTOR0002E"
760740
},
761741
"pool": {
@@ -780,14 +760,12 @@
780760
},
781761
"vmstorage_update": {
782762
"type": "object",
783-
"required": [
784-
"path"
785-
],
786763
"error": "KCHVMSTOR0013E",
787764
"properties": {
788765
"path": {
789766
"description": "Path of iso image file or disk mount point",
790767
"type": "string",
768+
"required": true,
791769
"pattern": "^(|(/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
792770
"error": "KCHVMSTOR0003E"
793771
}
@@ -932,13 +910,11 @@
932910
},
933911
"vmhostdevs_create": {
934912
"type": "object",
935-
"required": [
936-
"name"
937-
],
938913
"properties": {
939914
"name": {
940915
"description": "Then name of the device to assign to VM",
941916
"type": "string",
917+
"required": true,
942918
"pattern": "^[_A-Za-z0-9-]+$",
943919
"error": "KCHVMHDEV0004E"
944920
}

0 commit comments

Comments
 (0)