From 71ffc5c2acaf06488de5bcff8d014723f6d75fd6 Mon Sep 17 00:00:00 2001 From: Niklas Kiefer Date: Tue, 31 Oct 2023 17:57:12 +0100 Subject: [PATCH] fix(schema): allow rows to be empty in form schema --- package-lock.json | 2 +- packages/form-js/CHANGELOG.md | 8 ++++---- packages/form-json-schema/package.json | 2 +- packages/form-json-schema/src/defs/layout.json | 2 +- .../test/fixtures/layout-empty-row.js | 15 +++++++++++++++ .../test/spec/{schemaSpec.js => schema.spec.js} | 0 .../{validationSpec.js => validation.spec.js} | 3 +++ 7 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 packages/form-json-schema/test/fixtures/layout-empty-row.js rename packages/form-json-schema/test/spec/{schemaSpec.js => schema.spec.js} (100%) rename packages/form-json-schema/test/spec/{validationSpec.js => validation.spec.js} (99%) diff --git a/package-lock.json b/package-lock.json index 30ab038ff..06b9b695e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21041,7 +21041,7 @@ }, "packages/form-json-schema": { "name": "@bpmn-io/form-json-schema", - "version": "1.3.3", + "version": "1.4.0", "license": "SEE LICENSE IN LICENSE" } }, diff --git a/packages/form-js/CHANGELOG.md b/packages/form-js/CHANGELOG.md index 218406b6c..c71d33d37 100644 --- a/packages/form-js/CHANGELOG.md +++ b/packages/form-js/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to [form-js](https://github.com/bpmn-io/form-js) are documen ___Note:__ Yet to be released changes appear here._ +### JSON Schema + +* `FEAT`: initial release, moved from https://github.com/pinussilvestrus/form-json-schema + ## 1.4.0 ### General @@ -37,10 +41,6 @@ ___Note:__ Yet to be released changes appear here._ `FEAT`: provide `additionalModules` to both viewer and editor ([#776](https://github.com/bpmn-io/form-js/pull/776)) -### JSON Schema - -* `FEAT`: initial release, moved from https://github.com/pinussilvestrus/form-json-schema - ## 1.3.3 ## General diff --git a/packages/form-json-schema/package.json b/packages/form-json-schema/package.json index 1ea9ba922..d1a1d90e0 100644 --- a/packages/form-json-schema/package.json +++ b/packages/form-json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@bpmn-io/form-json-schema", - "version": "1.3.3", + "version": "1.4.0", "description": "JSON Schema for form-js", "files": [ "resources" diff --git a/packages/form-json-schema/src/defs/layout.json b/packages/form-json-schema/src/defs/layout.json index 92f214bd9..86e6ab870 100644 --- a/packages/form-json-schema/src/defs/layout.json +++ b/packages/form-json-schema/src/defs/layout.json @@ -6,7 +6,7 @@ "properties": { "row": { "$id": "/#component/layout/row", - "type": "string", + "type": [ "string", "null" ], "description": "Row in which a form field is placed." }, "columns": { diff --git a/packages/form-json-schema/test/fixtures/layout-empty-row.js b/packages/form-json-schema/test/fixtures/layout-empty-row.js new file mode 100644 index 000000000..e57b7942e --- /dev/null +++ b/packages/form-json-schema/test/fixtures/layout-empty-row.js @@ -0,0 +1,15 @@ +export const form = { + type: 'default', + components: [ + { + type: 'textfield', + key: 'firstName', + layout: { + row: null, + columns: 12 + } + } + ] +}; + +export const errors = null; \ No newline at end of file diff --git a/packages/form-json-schema/test/spec/schemaSpec.js b/packages/form-json-schema/test/spec/schema.spec.js similarity index 100% rename from packages/form-json-schema/test/spec/schemaSpec.js rename to packages/form-json-schema/test/spec/schema.spec.js diff --git a/packages/form-json-schema/test/spec/validationSpec.js b/packages/form-json-schema/test/spec/validation.spec.js similarity index 99% rename from packages/form-json-schema/test/spec/validationSpec.js rename to packages/form-json-schema/test/spec/validation.spec.js index 352d6707a..b2d935393 100644 --- a/packages/form-json-schema/test/spec/validationSpec.js +++ b/packages/form-json-schema/test/spec/validation.spec.js @@ -102,6 +102,9 @@ describe('validation', function() { testForm('validate-validationType'); + testForm('layout-empty-row'); + + describe('rules - required properties', function() {