File tree Expand file tree Collapse file tree 5 files changed +36
-5
lines changed
Expand file tree Collapse file tree 5 files changed +36
-5
lines changed Original file line number Diff line number Diff line change 11# nextflow-io/nf-schema: Changelog
22
3- # Version 2.3.0
3+ # Version 2.2.1
44
55## Bug fixes
66
771 . Fixed a bug in ` paramsSummaryMap() ` related to the processing of workflow config files.
8+ 2 . Fixed a bug where ` validation.defaultIgnoreParams ` and ` validation.ignoreParams ` would not actually ignore the parameter validation.
89
910# Version 2.2.0 - Kitakata
1011
Original file line number Diff line number Diff line change @@ -330,8 +330,12 @@ class SchemaValidator extends PluginExtensionPoint {
330330 // Validate
331331 List<String > validationErrors = validator. validate(paramsJSON, schema_string)
332332 this . errors. addAll(validationErrors)
333- if (this . hasErrors()) {
334- def msg = " ${ colors.red} The following invalid input values have been detected:\n\n " + errors. join(' \n ' ). trim() + " \n ${ colors.reset} \n "
333+ def List<String > modifiedIgnoreParams = config. ignoreParams. collect { param -> " * --${ param} " as String }
334+ def List<String > filteredErrors = errors. findAll { error ->
335+ return modifiedIgnoreParams. find { param -> error. startsWith(param) } == null
336+ }
337+ if (filteredErrors. size() > 0 ) {
338+ def msg = " ${ colors.red} The following invalid input values have been detected:\n\n " + filteredErrors. join(' \n ' ). trim() + " \n ${ colors.reset} \n "
335339 log. error(" Validation of pipeline parameters failed!" )
336340 throw new SchemaValidationException (msg, this . getErrors())
337341 }
Original file line number Diff line number Diff line change @@ -52,6 +52,5 @@ class ValidationConfig {
5252 }
5353 ignoreParams + = config. defaultIgnoreParams ?: []
5454 ignoreParams + = ' nf_test_output' // ignore `nf_test_output` directory when using nf-test
55-
5655 }
5756}
Original file line number Diff line number Diff line change 11Manifest-Version : 1.0
22Plugin-Id : nf-schema
3- Plugin-Version : 2.2.0
3+ Plugin-Version : 2.2.1
44Plugin-Class : nextflow.validation.ValidationPlugin
55Plugin-Provider : nextflow
66Plugin-Requires : >=23.10.0
Original file line number Diff line number Diff line change @@ -483,6 +483,33 @@ class ValidateParametersTest extends Dsl2Spec{
483483 ! stdout
484484 }
485485
486+ def ' should ignore wrong expected params' () {
487+ given :
488+ def schema = Path . of(' src/testResources/nextflow_schema.json' ). toAbsolutePath(). toString()
489+ def SCRIPT = """
490+ params.input = 1
491+ params.outdir = 2
492+ include { validateParameters } from 'plugin/nf-schema'
493+
494+ validateParameters(parameters_schema: '$schema ')
495+ """
496+
497+ when :
498+ def config = [" validation" : [
499+ " ignoreParams" : [' input' ],
500+ " defaultIgnoreParams" : [' outdir' ]
501+ ]]
502+ def result = new MockScriptRunner (config). setScript(SCRIPT ). execute()
503+ def stdout = capture
504+ .toString()
505+ .readLines()
506+ .findResults {it. contains(' WARN nextflow.validation.SchemaValidator' ) || it. startsWith(' * --' ) ? it : null }
507+
508+ then :
509+ noExceptionThrown()
510+ ! stdout
511+ }
512+
486513 def ' should fail for unexpected param' () {
487514 given :
488515 def schema = Path . of(' src/testResources/nextflow_schema.json' ). toAbsolutePath(). toString()
You can’t perform that action at this time.
0 commit comments