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
Pipeline #36530 failed with stage
in 0 seconds
{
"type": "object",
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Input Parameters",
"$defs": {
"instance-parameters": {
"type": "object",
"properties": {
"enable-device-hotplug": {
"title": "Enable device hotplug mode",
......@@ -428,4 +431,12 @@
}
}
}
}
},
"unevaluatedProperties": false,
"allOf": [
{
"$ref": "#/$defs/instance-parameters"
}
]
}
......@@ -2,13 +2,12 @@
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"description": "Parameters to instantiate resilient KVM",
"unevaluatedProperties": false,
"allOf": [
{
"$ref": "./instance-kvm-input-schema.json#",
"additionalProperties": true
},
{
"additionalProperties": true,
"$ref": "./instance-kvm-input-schema.json#/$defs/instance-parameters"
}
],
"properties": {
"resilient-clone-number": {
"title": "Amount of backup(s) to create",
......@@ -61,6 +60,4 @@
"optional": true
}
}
}
]
}
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"description": "Parameters to instantiate Theia",
"additionalProperties": false,
"$defs": {
"instance-parameters": {
"type": "object",
"properties": {
"autorun": {
"title": "Automatically Run Software/Instance",
......@@ -72,4 +73,12 @@
"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",
"description": "Parameters to instantiate resilient Theia",
"unevaluatedProperties": false,
"allOf": [
{
"$ref": "./instance-input-schema.json#",
"additionalProperties": true
},
{
"additionalProperties": true,
"$ref": "./instance-input-schema.json#/$defs/instance-parameters"
}
],
"properties": {
"resilient-clone-number": {
"title": "Amount of backup(s) to create",
......@@ -63,6 +62,4 @@
"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