From 5f957794e9be88ff500210191fc9dbba31a8912c Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Fri, 17 Nov 2023 14:17:01 +0100 Subject: [PATCH 1/4] Parameters meta-schema - first draft See https://github.com/nf-core/tools/issues/2436 --- parameters_meta_schema.json | 158 ++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 parameters_meta_schema.json diff --git a/parameters_meta_schema.json b/parameters_meta_schema.json new file mode 100644 index 00000000..ece1504b --- /dev/null +++ b/parameters_meta_schema.json @@ -0,0 +1,158 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://nextflow.io", + "title": "Nextflow Schema Meta-schema", + "description": "Meta-schema to validate Nextflow parameter schema files", + "type": "object", + "properties": { + "$schema": { + "title": "schema", + "type": "string", + "minLength": 1 + }, + "$id": { + "title": "ID URI", + "type": "string", + "minLength": 1 + }, + "title": { + "title": "Title", + "type": "string", + "minLength": 1 + }, + "description": { + "title": "Description", + "type": "string", + "minLength": 1 + }, + "type": { + "title": "Top level type", + "type": "string", + "const": "object" + }, + "definitions": { + "title": "Parameter groups", + "type": "object", + "patternProperties": { + "^.*$": { + "type": "object", + "required": [ + "title", + "type", + "properties" + ], + "properties": { + "title": { + "type": "string", + "minLength": 1 + }, + "type": { + "const": "object" + }, + "fa_icon": { + "type": "string", + "pattern": "^fa" + }, + "description": { + "type": "string", + "minLength": 1 + }, + "required": { + "type": "array" + }, + "properties": { + "type": "object", + "patternProperties": { + "^.*$": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": ["string", "boolean", "integer", "number"] + }, + "format": { + "type": "string", + "enum": ["file-path", "directory-path", "path"] + }, + "exists": { + "type": "boolean" + }, + "mimetype": { + "type": "string", + "pattern": ".+/.+" + }, + "pattern": { + "type": "string", + "minLength": 1 + }, + "schema": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string", + "minLength": 1 + }, + "help_text": { + "type": "string", + "minLength": 1 + }, + "fa_icon": { + "type": "string", + "pattern": "^fa" + }, + "errorMessage": { + "type": "string", + "minLength": 1 + }, + "hidden": { + "type": "boolean" + }, + "minLength": { + "type": "integer" + }, + "maxLength": { + "type": "integer" + }, + "minimum": { + "type": "integer" + }, + "maximum": { + "type": "integer" + } + } + } + } + } + } + } + } + }, + "allOf": { + "title": "Combine definition groups", + "type": "array", + "items": { + "type": "object", + "required": [ + "$ref" + ], + "properties": { + "$ref": { + "type": "string", + "pattern": "^#/definitions/" + } + } + } + } + }, + "required": [ + "$schema", + "$id", + "title", + "description", + "type" + ] +} From d1914c4158fe526749ae6576a84a494d71466f19 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Fri, 17 Nov 2023 17:37:26 +0100 Subject: [PATCH 2/4] add file path pattern Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> --- parameters_meta_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameters_meta_schema.json b/parameters_meta_schema.json index ece1504b..24b11ea3 100644 --- a/parameters_meta_schema.json +++ b/parameters_meta_schema.json @@ -75,7 +75,7 @@ }, "format": { "type": "string", - "enum": ["file-path", "directory-path", "path"] + "enum": ["file-path", "directory-path", "path", "file-path-pattern"] }, "exists": { "type": "boolean" From e5e670a176436108c470734fe459a58a6481a6df Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Mon, 20 Nov 2023 11:09:50 +0100 Subject: [PATCH 3/4] Allow zero-length strings in 'description' --- parameters_meta_schema.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parameters_meta_schema.json b/parameters_meta_schema.json index 24b11ea3..9f555641 100644 --- a/parameters_meta_schema.json +++ b/parameters_meta_schema.json @@ -54,8 +54,7 @@ "pattern": "^fa" }, "description": { - "type": "string", - "minLength": 1 + "type": "string" }, "required": { "type": "array" From e1e95cba78861427ba64c5a154edc1925c63e8a8 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Mon, 20 Nov 2023 11:17:44 +0100 Subject: [PATCH 4/4] Remove requirement for > zero length strings for description + help_text fields --- parameters_meta_schema.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/parameters_meta_schema.json b/parameters_meta_schema.json index 9f555641..5d5f58b9 100644 --- a/parameters_meta_schema.json +++ b/parameters_meta_schema.json @@ -92,12 +92,10 @@ "minLength": 1 }, "description": { - "type": "string", - "minLength": 1 + "type": "string" }, "help_text": { - "type": "string", - "minLength": 1 + "type": "string" }, "fa_icon": { "type": "string",