Commit 6e8edc27 authored by Jérome Perrin's avatar Jérome Perrin

software/{kvm,theia}: use unevaluatedProperties for schema composition

This is based on example from https://json-schema.org/understanding-json-schema/reference/object#unevaluatedproperties
this approach allows extending a schema from another software type with
some extra properties while rejecting other properties on instances,
like it's done with additionalProperties: false.
parent d170acc7
{ {
"type": "object", "type": "object",
"$schema": "http://json-schema.org/draft-06/schema#", "$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Input Parameters", "title": "Input Parameters",
"$defs": {
"instance-parameters": {
"type": "object",
"properties": { "properties": {
"enable-device-hotplug": { "enable-device-hotplug": {
"title": "Enable device hotplug mode", "title": "Enable device hotplug mode",
...@@ -428,4 +431,12 @@ ...@@ -428,4 +431,12 @@
} }
} }
} }
}
},
"unevaluatedProperties": false,
"allOf": [
{
"$ref": "#/$defs/instance-parameters"
}
]
} }
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
"type": "object", "type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema#", "$schema": "https://json-schema.org/draft/2020-12/schema#",
"description": "Parameters to instantiate resilient KVM", "description": "Parameters to instantiate resilient KVM",
"unevaluatedProperties": false,
"allOf": [ "allOf": [
{ {
"$ref": "./instance-kvm-input-schema.json#", "$ref": "./instance-kvm-input-schema.json#/$defs/instance-parameters"
"additionalProperties": true }
}, ],
{
"additionalProperties": true,
"properties": { "properties": {
"resilient-clone-number": { "resilient-clone-number": {
"title": "Amount of backup(s) to create", "title": "Amount of backup(s) to create",
...@@ -61,6 +60,4 @@ ...@@ -61,6 +60,4 @@
"optional": true "optional": true
} }
} }
}
]
} }
{ {
"$schema": "http://json-schema.org/draft-06/schema#", "$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"description": "Parameters to instantiate Theia", "description": "Parameters to instantiate Theia",
"additionalProperties": false, "$defs": {
"instance-parameters": {
"type": "object",
"properties": { "properties": {
"autorun": { "autorun": {
"title": "Automatically Run Software/Instance", "title": "Automatically Run Software/Instance",
...@@ -72,4 +73,12 @@ ...@@ -72,4 +73,12 @@
"default": "RootSoftwareInstance" "default": "RootSoftwareInstance"
} }
} }
}
},
"unevaluatedProperties": false,
"allOf": [
{
"$ref": "#/$defs/instance-parameters"
}
]
} }
{ {
"$schema": "https://json-schema.org/draft/2020-12/schema#", "$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object", "type": "object",
"description": "Parameters to instantiate resilient Theia", "description": "Parameters to instantiate resilient Theia",
"unevaluatedProperties": false,
"allOf": [ "allOf": [
{ {
"$ref": "./instance-input-schema.json#", "$ref": "./instance-input-schema.json#/$defs/instance-parameters"
"additionalProperties": true }
}, ],
{
"additionalProperties": true,
"properties": { "properties": {
"resilient-clone-number": { "resilient-clone-number": {
"title": "Amount of backup(s) to create", "title": "Amount of backup(s) to create",
...@@ -63,6 +62,4 @@ ...@@ -63,6 +62,4 @@
"optional": true "optional": true
} }
} }
}
]
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment