From 42fe80492b3cf41553704b66f7955b16c378cbd4 Mon Sep 17 00:00:00 2001 From: Guillem CANAL Date: Thu, 17 Dec 2020 12:51:58 +0100 Subject: [PATCH] fix: ngx form json schema definition (#378) * fix: ngx form json schema definition * fix: widgetType json schema definition * fix: allow the use of numbers in visibleIf * feat: ensure that the custom widget id is not blank --- schema/ngx-schema-form-schema.json | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/schema/ngx-schema-form-schema.json b/schema/ngx-schema-form-schema.json index e3533c8e..276dc410 100644 --- a/schema/ngx-schema-form-schema.json +++ b/schema/ngx-schema-form-schema.json @@ -4,15 +4,17 @@ "$comment": "Definition of all types supported by ngx-schema-form", "title": "JSON Schema ngx-schema-form", "type": "object", - "$ref": "#/definitions/formWidgetType", "allOf": [ + { + "$ref": "#/definitions/formWidgetType" + }, { "$ref": "http://json-schema.org/draft-07/schema#" } ], "definitions": { "widgetTypeCustom": { - "type": "string", + "$ref": "#/definition/stringNotBlank", "description": "[NSF] - The name of custom widget type to use" }, "widgetTypeSimple": { @@ -50,7 +52,7 @@ "properties": { "id": { "description": "[NSF] - The id of the widget.", - "oneOf": [ + "anyOf": [ { "$ref": "#/definitions/widgetTypeSimple" }, @@ -206,6 +208,9 @@ }, { "type": "null" + }, + { + "type": "number" } ] } @@ -219,7 +224,7 @@ "description": "[NSF] - The form title of the root form. Will only be showed when is an inline form" }, "widget": { - "oneOf": [ + "anyOf": [ { "$ref": "#/definitions/widgetTypeSimple" }, @@ -270,6 +275,11 @@ "type": "object", "description": "[NSF] - A form widget.", "additionalProperties": true + }, + "stringNotBlank": { + "type": "string", + "pattern": "^\\S*$", + "minLength": 1 } } }