Commit 4a42f2f1 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: WIP Start refactoring load_schema

    Replace tv4 by ajv7 and update the support to rely on Draft-7 by default
    Replace custom code by ref-parser to expand Schemas
    Minor changes on parameter_form for handle response from software.cfg.json
parent 23799c41
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="URI.js" type="text/javascript"></script> <script src="URI.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script> <script src="jquery.js" type="text/javascript"></script>
<script src="ref-parser.min.js" type="text/javascript"></script>
<script src="tv4.min.js" type="text/javascript"></script>
<script src="URI.js" type="text/javascript"></script> <script src="URI.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script> <script src="jiodev.js" type="text/javascript"></script>
<script src="ajv7.min.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_load_schema.js" type="text/javascript"></script> <script src="gadget_erp5_page_slap_load_schema.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>999.37330.56513.53265</string> </value> <value> <string>1000.45816.7111.13465</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1650027159.97</float> <float>1654381049.77</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint nomen: true, maxlen: 200, indent: 2*/ /*jslint nomen: true, maxlen: 200, indent: 2*/
/*global window, rJS, console, RSVP, jQuery, jIO, tv4, URI, JSON, $, btoa */ /*global window, rJS, console, RSVP, ajv7, URI, jIO, JSON, btoa, $RefParser */
(function (window, rJS, $, RSVP, btoa, URI, tv4) { (function (window, rJS, RSVP, btoa, URI, ajv7, jIO, JSON, $RefParser) {
"use strict"; "use strict";
var gk = rJS(window); var gk = rJS(window),
Ajv = ajv7;
function getJSON(url) { function getJSON(url) {
var uri = URI(url), var uri = URI(url),
...@@ -31,195 +32,34 @@ ...@@ -31,195 +32,34 @@
}); });
} }
function resolveLocalReference(ref, schema) { function validateJSONSchema(schema_url, serialisation) {
// 2 here is for #/ var meta_schema_url = "slapos_load_meta_schema.json";
var i, ref_path = ref.substr(2, ref.length), /*if (serialisation === "xml") {
parts = ref_path.split("/"); meta_schema_url = "slapos_load_meta_schema_xml.json";
if (parts.length === 1 && parts[0] === "") {
// It was uses #/ to reference the entire json so just return it.
return schema;
} }
for (i = 0; i < parts.length; i += 1) { if (serialisation === "json-in-xml") {
schema = schema[parts[i]]; meta_schema_url = "slapos_load_meta_schema_json_in_xml.json";
} }*/
return schema;
}
function resolveReference(partial_schema, schema, base_url) {
var parts,
external_schema,
ref = partial_schema.$ref;
if (ref === undefined) {
return new RSVP.Queue().push(function () {
return partial_schema;
});
}
if (ref.substr(0, 1) === "#") {
return new RSVP.Queue().push(function () {
return resolveLocalReference(ref, schema);
});
}
return new RSVP.Queue().push(function () {
if (URI(ref).protocol() === "") {
if (base_url !== undefined) {
ref = base_url + "/" + ref;
}
}
return getJSON(ref);
})
.push(function (json) {
external_schema = JSON.parse(json);
parts = ref.split("#");
ref = "#" + parts[1];
return resolveLocalReference(ref, external_schema);
});
}
function clone(obj) {
return JSON.parse(JSON.stringify(obj));
}
// Inspired from https://github.com/nexedi/dream/blob/master/dream/platform/src/jsplumb/jsplumb.js#L398
function expandSchema(json_schema, full_schema, base_url) {
var i,
expanded_json_schema = clone(json_schema) || {};
if (!expanded_json_schema.properties) {
expanded_json_schema.properties = {};
}
return new RSVP.Queue().push(function () {
if (json_schema.$ref) {
return resolveReference(
json_schema,
full_schema,
base_url
)
.push(function (remote_schema) {
return expandSchema(
remote_schema,
full_schema,
base_url
);
}).push(function (referencedx) {
$.extend(expanded_json_schema, referencedx);
delete expanded_json_schema.$ref;
return true;
});
}
return true;
}).push(function () {
var property, queue = new RSVP.Queue();
function wrapperResolveReference(p) {
return resolveReference(
json_schema.properties[p],
full_schema,
base_url
).push(function (external_schema) {
// console.log(p);
return expandSchema(
external_schema,
full_schema,
base_url
)
.push(function (referencedx) {
$.extend(expanded_json_schema.properties[p], referencedx);
if (json_schema.properties[p].$ref) {
delete expanded_json_schema.properties[p].$ref;
}
return referencedx;
});
});
}
// expand ref in properties
for (property in json_schema.properties) {
if (json_schema.properties.hasOwnProperty(property)) {
queue.push(
wrapperResolveReference.bind(this, property)
);
}
}
return queue;
})
.push(function () {
var zqueue = new RSVP.Queue();
function wrapperExpandSchema(p) { return getJSON(meta_schema_url)
return expandSchema( .push(function (meta_schema) {
json_schema.allOf[p], return new RSVP.Queue()
full_schema, .push(function () {
base_url return $RefParser
).push(function (referencedx) { .dereference(schema_url)
if (referencedx.properties) { .then(function (schema) {
$.extend( return schema;
expanded_json_schema.properties, });
referencedx.properties })
); .push(function (schema) {
delete referencedx.properties; if (!new Ajv({allowUnionTypes: true}).validate(JSON.parse(meta_schema), schema)) {
throw new Error("Non valid JSON schema " + JSON.stringify(schema));
} }
$.extend(expanded_json_schema, referencedx); return schema;
}); });
}
if (json_schema.allOf) {
for (i = 0; i < json_schema.allOf.length; i += 1) {
zqueue.push(wrapperExpandSchema.bind(this, i));
}
}
return zqueue;
})
.push(function () {
if (expanded_json_schema.allOf) {
delete expanded_json_schema.allOf;
}
if (expanded_json_schema.$ref) {
delete expanded_json_schema.$ref;
}
// console.log(expanded_json_schema);
return clone(expanded_json_schema);
}); });
} }
function getMetaJSONSchema(serialisation) {
if (serialisation === "xml") {
return getJSON("slapos_load_meta_schema_xml.json");
}
if (serialisation === "json-in-xml") {
return getJSON("slapos_load_meta_schema_json_in_xml.json");
}
return getJSON("slapos_load_meta_schema.json");
}
function validateJSONSchema(json, base_url, serialisation) {
return getMetaJSONSchema(serialisation)
.push(function (meta_schema) {
if (!tv4.validate(json, meta_schema)) {
throw new Error("Non valid JSON schema " + json);
}
return JSON.parse(json);
})
.push(function (schema) {
return expandSchema(schema, schema, base_url);
});
}
function validateSoftwareJSONSchema(json) {
return getJSON("slapos_load_software_schema.json")
.push(function (schema) {
if (!tv4.validate(json, schema)) {
throw new Error("Non valid JSON for software.cfg.json:" + json);
}
return JSON.parse(json);
});
}
gk gk
.declareMethod("getBaseUrl", function (url) { .declareMethod("getBaseUrl", function (url) {
var base_url, url_uri = URI(url); var base_url, url_uri = URI(url);
...@@ -229,20 +69,26 @@ ...@@ -229,20 +69,26 @@
return base_url; return base_url;
}) })
.declareMethod("loadJSONSchema", function (url, serialisation) { .declareMethod("loadJSONSchema", function (url, serialisation) {
var gadget = this; return validateJSONSchema(url, serialisation);
return getJSON(url)
.push(function (json) {
return gadget.getBaseUrl(url)
.push(function (base_url) {
return validateJSONSchema(json, base_url, serialisation);
});
});
}) })
.declareMethod("loadSoftwareJSON", function (url) { .declareMethod("loadSoftwareJSON", function (url) {
return getJSON(url) return getJSON(url)
.push(function (json) { .push(function (software_cfg_json) {
return validateSoftwareJSONSchema(json); return new RSVP.Queue()
.push(function () {
return $RefParser
.dereference("slapos_load_software_schema.json")
.then(function (software_schema) {
return software_schema;
});
})
.push(function (software_schema) {
if (!new Ajv().validate(software_schema, JSON.parse(software_cfg_json))) {
throw new Error("Non valid JSON for software.cfg.json:" + software_cfg_json);
}
return JSON.parse(software_cfg_json);
});
}); });
}) })
...@@ -255,13 +101,17 @@ ...@@ -255,13 +101,17 @@
} }
} }
return getJSON(parameter_schema_url) return new RSVP.Queue()
.push(function (json) { .push(function () {
var schema = JSON.parse(json); return $RefParser
return expandSchema(schema, schema, base_url) .dereference(parameter_schema_url)
.push(function (loaded_json) { .then(function (schema) {
return tv4.validateMultiple(generated_json, loaded_json); schema.$schema = "http://json-schema.org/draft-07/schema#";
return schema;
}); });
})
.push(function (schema) {
return new Ajv({"strict": false}).validate(schema, generated_json);
}); });
}); });
}(window, rJS, $, RSVP, btoa, URI, tv4)); }(window, rJS, RSVP, btoa, URI, ajv7, jIO, JSON, $RefParser));
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.28125.59086.62805</string> </value> <value> <string>1000.47636.62020.13260</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1583836689.5</float> <float>1654490382.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
padding-top: 10px; padding-top: 10px;
} }
.subfield span:not(.slapos-parameter) {
.subfield span {
font-weight: normal; font-weight: normal;
font-style: italic; font-style: italic;
padding-left: 7px; padding-left: 7px;
...@@ -17,17 +14,17 @@ ...@@ -17,17 +14,17 @@
.subfield textarea {width: 250px; height: 60px;} .subfield textarea {width: 250px; height: 60px;}
.hidden-software-type {
display: none;
}
.subfield .error { .subfield .error {
color: #E82525; color: #E82525;
font-weight: 700; font-weight: 700;
} }
.input button {margin-left: 10px;} .input button {margin-left: 10px;}
.bt_close, .subfield .slapos-parameter-dict-key span.bt_close{ .bt_close, .subfield .slapos-parameter-dict-key span.bt_close{
padding: 0 6px; padding: 0 6px;
display: block; display: block;
...@@ -62,7 +59,6 @@ button.hidden-button { ...@@ -62,7 +59,6 @@ button.hidden-button {
word-break: keep-all; word-break: keep-all;
} }
.non-editable > div.input {border: 1px solid rgb(201, 201, 201); padding: 5px; background: white; font-weight: normal; .non-editable > div.input {border: 1px solid rgb(201, 201, 201); padding: 5px; background: white; font-weight: normal;
margin: 5px 0 10px; max-height: 250px; width: 80%;} margin: 5px 0 10px; max-height: 250px; width: 80%;}
...@@ -74,7 +70,6 @@ label.slapos-parameter-dict-key::before { ...@@ -74,7 +70,6 @@ label.slapos-parameter-dict-key::before {
content: "Parameter Entry: "; content: "Parameter Entry: ";
} }
div.slapos-parameter-dict-key { div.slapos-parameter-dict-key {
margin-top: 10px; margin-top: 10px;
margin-left: 6px; margin-left: 6px;
...@@ -123,15 +118,21 @@ fieldset > div.subfield { ...@@ -123,15 +118,21 @@ fieldset > div.subfield {
cursor: text; cursor: text;
} }
.field input:not(:placeholder-shown) ~ span:not(.error), .field input:not(:placeholder-shown) ~ span:not(.error),
.subfield input:not(:placeholder-shown) ~ span:not(.error) { .subfield input:not(:placeholder-shown) ~ span:not(.error),
.field select:not(:placeholder-shown) ~ span:not(.error),
.subfield select:not(:placeholder-shown) ~ span:not(.error) {
visibility: hidden; visibility: hidden;
} }
.field input ~ span:not(.error), .field input ~ span:not(.error),
.subfield input ~ span:not(.error) { .subfield input ~ span:not(.error),
.field select ~ span:not(.error),
.subfield select ~ span:not(.error) {
opacity: .7; opacity: .7;
} }
.field input:focus ~ span, .field input:focus ~ span,
.subfield input:focus ~ span { .subfield input:focus ~ span,
.field select:focus ~ span,
.subfield select:focus ~ span {
visibility: hidden; visibility: hidden;
} }
.subfield .input { .subfield .input {
...@@ -195,14 +196,14 @@ label.slapos-parameter-dict-key ~ div.input label { ...@@ -195,14 +196,14 @@ label.slapos-parameter-dict-key ~ div.input label {
left: 4px; left: 4px;
} }
.subfield { .subfield {
min-height: 5em; min-height: 5em;
} }
.subfield select { .subfield select {
margin-bottom: 0; margin-bottom: 0;
} }
.subfield .input select + span { .subfield .input select + span {
position: relative; position: relative;
top: -1.9em; top: -1.9em;
opacity: .7; opacity: .7;
} }
...@@ -71,7 +71,9 @@ ...@@ -71,7 +71,9 @@
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>text/css</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>creators</string> </key> <key> <string>creators</string> </key>
...@@ -267,7 +269,7 @@ ...@@ -267,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>977.18105.11982.10410</string> </value> <value> <string>1000.42171.35611.13448</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -285,7 +287,7 @@ ...@@ -285,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1563920275.64</float> <float>1654164481.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -342,9 +342,9 @@ ...@@ -342,9 +342,9 @@
} else { } else {
input = render_field({"type": "string", "textarea": true}, default_dict[key]); input = render_field({"type": "string", "textarea": true}, default_dict[key]);
input.name = path + "/" + key; input.name = path + "/" + key;
input.setAttribute("class", "slapos-parameter");
input.setAttribute("placeholder", " ");
} }
input.setAttribute("class", "slapos-parameter");
input.setAttribute("placeholder", " ");
div.setAttribute("class", "subfield"); div.setAttribute("class", "subfield");
div.appendChild(domsugar("label", {text: key})); div.appendChild(domsugar("label", {text: key}));
div_input = domsugar("div", div_input = domsugar("div",
...@@ -731,6 +731,7 @@ ...@@ -731,6 +731,7 @@
shared = gadget.state.shared, shared = gadget.state.shared,
softwaretype = gadget.state.softwaretype, softwaretype = gadget.state.softwaretype,
softwareindex = gadget.state.softwareindex, softwareindex = gadget.state.softwareindex,
parameter_type = "request",
editable = gadget.state.editable, editable = gadget.state.editable,
to_hide = gadget.element.querySelector("button.slapos-show-form"), to_hide = gadget.element.querySelector("button.slapos-show-form"),
to_show = gadget.element.querySelector("button.slapos-show-raw-parameter"); to_show = gadget.element.querySelector("button.slapos-show-raw-parameter");
...@@ -746,6 +747,9 @@ ...@@ -746,6 +747,9 @@
if (to_show !== null) { if (to_show !== null) {
$(to_show).removeClass("hidden-button"); $(to_show).removeClass("hidden-button");
} }
if (gadget.state.parameter_type === "response") {
parameter_type = "response";
}
return gadget.loadSoftwareJSON(json_url) return gadget.loadSoftwareJSON(json_url)
.push(function (json) { .push(function (json) {
var option_index, var option_index,
...@@ -869,10 +873,10 @@ ...@@ -869,10 +873,10 @@
s_input.value = json.serialisation; s_input.value = json.serialisation;
serialisation = json.serialisation; serialisation = json.serialisation;
} }
if (parameter_type === "response") {
// Save current schema on the field $(input.parentNode.parentNode).addClass("hidden-software-type");
parameter_schema_url.value = json['software-type'][option_selected_index].request; }
parameter_schema_url.value = json['software-type'][option_selected_index][parameter_type];
return parameter_schema_url.value; return parameter_schema_url.value;
}) })
.push(function (parameter_json_schema_url) { .push(function (parameter_json_schema_url) {
...@@ -1009,6 +1013,7 @@ ...@@ -1009,6 +1013,7 @@
softwaretype: options.value.parameter.softwaretype, softwaretype: options.value.parameter.softwaretype,
softwareindex: options.value.parameter.softwareindex, softwareindex: options.value.parameter.softwareindex,
editable: options.editable, editable: options.editable,
parameter_type: options.value.parameter.parameter_type,
// Force refresh in any case // Force refresh in any case
render_timestamp: new Date().getTime() render_timestamp: new Date().getTime()
}); });
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1000.19711.33506.41574</string> </value> <value> <string>1000.42184.19212.4778</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1652829218.23</float> <float>1654164608.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="domsugar.js" type="text/javascript"></script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_erp5_page_slap_software_instance_view.js" type="text/javascript"></script> <script src="gadget_erp5_page_slap_software_instance_view.js" type="text/javascript"></script>
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.64771.37209.11025</string> </value> <value> <string>1000.2322.46712.16657</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1508861025.92</float> <float>1654159000.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
{ {
"id": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "http://json-schema.org/draft-04/schema#", "title": "Core schema meta-schema",
"description": "Core schema meta-schema",
"definitions": { "definitions": {
"schemaArray": { "schemaArray": {
"type": "array", "type": "array",
"minItems": 1, "minItems": 1,
"items": { "$ref": "#" } "items": { "$ref": "#" }
}, },
"positiveInteger": { "nonNegativeInteger": {
"type": "integer", "type": "integer",
"minimum": 0 "minimum": 0
}, },
"positiveIntegerDefault0": { "nonNegativeIntegerDefault0": {
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] "allOf": [
{ "$ref": "#/definitions/nonNegativeInteger" },
{ "default": 0 }
]
}, },
"simpleTypes": { "simpleTypes": {
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] "enum": [
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
}, },
"stringArray": { "stringArray": {
"type": "array", "type": "array",
"items": { "type": "string" }, "items": { "type": "string" },
"minItems": 1, "uniqueItems": true,
"uniqueItems": true "default": []
} }
}, },
"type": "object", "type": ["object", "boolean"],
"properties": { "properties": {
"id": { "$id": {
"type": "string", "type": "string"
"format": "uri"
}, },
"$schema": { "$schema": {
"type": "string", "type": "string"
"format": "uri" },
"$ref": {
"type": "string"
},
"$comment": {
"type": "string"
}, },
"title": { "title": {
"type": "string" "type": "string"
...@@ -41,62 +55,59 @@ ...@@ -41,62 +55,59 @@
"description": { "description": {
"type": "string" "type": "string"
}, },
"default": {}, "default": true,
"readOnly": {
"type": "boolean",
"default": false
},
"writeOnly": {
"type": "boolean",
"default": false
},
"examples": {
"type": "array",
"items": true
},
"multipleOf": { "multipleOf": {
"type": "number", "type": "number",
"minimum": 0, "exclusiveMinimum": 0
"exclusiveMinimum": true
}, },
"maximum": { "maximum": {
"type": "number" "type": "number"
}, },
"exclusiveMaximum": { "exclusiveMaximum": {
"type": "boolean", "type": "number"
"default": false
}, },
"minimum": { "minimum": {
"type": "number" "type": "number"
}, },
"exclusiveMinimum": { "exclusiveMinimum": {
"type": "boolean", "type": "number"
"default": false
}, },
"maxLength": { "$ref": "#/definitions/positiveInteger" }, "maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"pattern": { "pattern": {
"type": "string", "type": "string"
"format": "regex"
},
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
}, },
"additionalItems": { "$ref": "#" },
"items": { "items": {
"anyOf": [ "anyOf": [
{ "$ref": "#" }, { "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" } { "$ref": "#/definitions/schemaArray" }
], ],
"default": {} "default": true
}, },
"maxItems": { "$ref": "#/definitions/positiveInteger" }, "maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"uniqueItems": { "uniqueItems": {
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"maxProperties": { "$ref": "#/definitions/positiveInteger" }, "contains": { "$ref": "#" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" }, "required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": { "additionalProperties": { "$ref": "#" },
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"definitions": { "definitions": {
"type": "object", "type": "object",
"additionalProperties": { "$ref": "#" }, "additionalProperties": { "$ref": "#" },
...@@ -110,6 +121,7 @@ ...@@ -110,6 +121,7 @@
"patternProperties": { "patternProperties": {
"type": "object", "type": "object",
"additionalProperties": { "$ref": "#" }, "additionalProperties": { "$ref": "#" },
"propertyNames": {},
"default": {} "default": {}
}, },
"dependencies": { "dependencies": {
...@@ -121,8 +133,11 @@ ...@@ -121,8 +133,11 @@
] ]
} }
}, },
"propertyNames": { "$ref": "#" },
"const": true,
"enum": { "enum": {
"type": "array", "type": "array",
"items": true,
"minItems": 1, "minItems": 1,
"uniqueItems": true "uniqueItems": true
}, },
...@@ -137,14 +152,16 @@ ...@@ -137,14 +152,16 @@
} }
] ]
}, },
"format": { "type": "string" },
"contentMediaType": { "type": "string" },
"contentEncoding": { "type": "string" },
"if": { "$ref": "#" },
"then": { "$ref": "#" },
"else": { "$ref": "#" },
"allOf": { "$ref": "#/definitions/schemaArray" }, "allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" }, "anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" }, "oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" } "not": { "$ref": "#" }
}, },
"dependencies": { "default": true
"exclusiveMaximum": [ "maximum" ],
"exclusiveMinimum": [ "minimum" ]
},
"default": {}
} }
\ No newline at end of file
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>999.27453.45440.44629</string> </value> <value> <string>1000.47362.57711.3618</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1649434525.63</float> <float>1654473822.39</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
{ {
"$schema": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"description": "Slapos Software Release instantiation descriptor", "description": "Slapos Software Release instantiation descriptor",
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
......
...@@ -239,7 +239,7 @@ https://lab.nexedi.com/nexedi/slapos/raw/master/schema.json#</string> </value> ...@@ -239,7 +239,7 @@ https://lab.nexedi.com/nexedi/slapos/raw/master/schema.json#</string> </value>
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>999.32250.5458.58606</string> </value> <value> <string>1000.2322.46712.16657</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ https://lab.nexedi.com/nexedi/slapos/raw/master/schema.json#</string> </value> ...@@ -257,7 +257,7 @@ https://lab.nexedi.com/nexedi/slapos/raw/master/schema.json#</string> </value>
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1649721266.53</float> <float>1654471607.46</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TextAreaField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_connection_xml</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Connection XML</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>80</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>ajv7.min.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>ajv7.min.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>ref-parser.min.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{ {
"$schema": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"type": "object", "type": "object",
"description": "Extend simple parameter extension with extra only supported on json-in-xml", "description": "Extend simple parameter extension with extra only supported on json-in-xml",
"additionalProperties": false, "additionalProperties": false,
"allOf": [ "allOf": [
{ {
"$ref": "instance-input-schema.json#/" "$ref": "instance-input-schema.json#"
}, },
{ {
"properties": { "properties": {
......
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