From b3b1c97b61bb4d2d828415b8ba3149d08bfe89ee Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Wed, 14 Jun 2017 10:31:44 +0900 Subject: [PATCH] schema.json: Fix required property constraints and provide default values Also, describe a bit more "serialisation" override mechanism: these properties cannot be made required at schema level, but for any software-type entry a serialisation must be provided. --- schema.json | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/schema.json b/schema.json index 27d2610fb..e80ebcd55 100644 --- a/schema.json +++ b/schema.json @@ -2,49 +2,56 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Slapos Software Release instantiation descriptor", "additionalProperties": false, + "required": [ + "software-type" + ], "properties": { "name": { "description": "A short human-friendly name for the sofware release", + "default": "", "type": "string" }, "description": { "description": "A short description of the sofware release", + "default": "", "type": "string" }, "serialisation": { "description": "How the parameters and results are serialised", - "require": true, "enum": ["xml", "json-in-xml"], "type": "string" }, "software-type": { "description": "Existing software types", - "require": true, "patternProperties": { ".*": { "description": "Software type declaration", "additionalProperties": false, + "required": [ + "request", + "response" + ], "properties": { "title": { "description": "A human-friendly title of the software type", + "default": "", "type": "string" }, "description": { "description": "A human-friendly description of the software type", + "default": "", "type": "string" }, "serialisation": { - "description": "How the parameters and results are serialised, if different from global setting", + "description": "How the parameters and results are serialised, if different from global setting, required if global setting is not provided", "enum": ["xml", "json-in-xml"], "type": "string" }, "request": { - "require": true, "description": "URL, relative to Software Release base path, of a json schema for values expected by instance of current software type", "type": "string" }, "response": { - "require": true, "description": "URL, relative to Software Release base path, of a json schema for values published by instance of current software type", "type": "string" }, @@ -54,10 +61,12 @@ }, "shared" : { "description": "Define if the request will request a Slave or Software Instance.", + "default": "false", "type": "boolean" }, "index": { "description": "Value to use instead of software type id to sort them (in order to display most relevant software types earlier in a list, for example)", + "default": 0, "type": "number" } }, -- 2.30.9