From 943febaa509a52264dc14e93286f320bbc8f8214 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 21 Jul 2023 15:34:34 +0200 Subject: [PATCH 1/2] add parameters from schema top level as expected params --- CHANGELOG.md | 4 ++++ .../main/nextflow/validation/SchemaValidator.groovy | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed5a1b1b..cb43548d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nextflow-io/nf-validation: Changelog +# Version 0.4.0 + +- Add parameters defined on the top level of the schema and within the definitions section as expected params ([#79](https://github.com/nextflow-io/nf-validation/pull/79)) + ## Version 0.3.1 ### Bug fixes diff --git a/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy b/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy index acf90c92..a58e7c3c 100644 --- a/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy +++ b/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy @@ -281,6 +281,18 @@ class SchemaValidator extends PluginExtensionPoint { def enumsTuple = collectEnums(schemaParams) def List expectedParams = (List) enumsTuple[0] + addExpectedParams() def Map enums = (Map) enumsTuple[1] + // Collect expected parameters from the schema when parameters are specified outside of "definitions" + if (parsed.containsKey('properties')) { + def enumsTupleTopLevel = collectEnums(['top_level': ['properties': parsed.get('properties')]]) + expectedParams += (List) enumsTupleTopLevel[0] + enums += (Map) enumsTupleTopLevel[1] + } + // Collect expected parameters from the schema when parameters are specified within "definitions" + if (schemaParams.containsKey('properties')) { + def enumsTupleDefinitions = collectEnums(['definitions': ['properties': schemaParams.get('properties')]]) + expectedParams += (List) enumsTupleDefinitions[0] + enums += (Map) enumsTupleDefinitions[1] + } //=====================================================================// // Check if files or directories exist From 2a293c80f4146792a232d598b89410e998b59f7f Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 21 Aug 2023 10:49:29 +0200 Subject: [PATCH 2/2] don't take into account parameters within definitions --- .../src/main/nextflow/validation/SchemaValidator.groovy | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy b/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy index a58e7c3c..b8e3f9af 100644 --- a/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy +++ b/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy @@ -287,12 +287,6 @@ class SchemaValidator extends PluginExtensionPoint { expectedParams += (List) enumsTupleTopLevel[0] enums += (Map) enumsTupleTopLevel[1] } - // Collect expected parameters from the schema when parameters are specified within "definitions" - if (schemaParams.containsKey('properties')) { - def enumsTupleDefinitions = collectEnums(['definitions': ['properties': schemaParams.get('properties')]]) - expectedParams += (List) enumsTupleDefinitions[0] - enums += (Map) enumsTupleDefinitions[1] - } //=====================================================================// // Check if files or directories exist