Fix module run to allow optional path inputs#7163
Conversation
Signed-off-by: Ben Sherman <[email protected]>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
jorgee
left a comment
There was a problem hiding this comment.
Looks fine and fixes the issue case. Nothing is blocking from my side just minor comments.
|
One comment that come into my mind when reviewing the PR, but out of the scope of the PR. Can we have the same issue with input variables (val) in V1? Nothing in the documentation says that optional parameters are supported. I see a strange case, but not sure if it is done in nf-core modules or if optional parameters are just used for files? |
|
Took a closer look — overall this is a clean, surgical change. The downstream wiring is correct: I traced both the One thing worth considering, plus a few nice-to-haves: Important to considerThe original repro from #7161 ( The new guard in Users naturally write if( value == null || (param instanceof FileInParam && value instanceof CharSequence && !value) ) {
if( param instanceof FileInParam )
return []
throw new IllegalArgumentException("Missing required parameter: --${name}")
}Or, document explicitly in the changelog / docs that the user must omit the flag rather than pass an empty string. Nice to have
Follow-up idea (not for this PR)The PR notes that legacy processes have no way to declare optionality. The recently-merged |
Co-authored-by: Jorge Ejarque <[email protected]> Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
4107dba to
6628cbc
Compare
In theory yes, This fix is needed for |
Close #7161
This PR adds support for optional file inputs to
nextflow module run.When a
pathinput is not supplied a value at runtime, the ProcessEntryHandler defaults to[]instead of throwing an error. This is needed to allow for optional file inputs which are a common use case.For legacy processes, one consequence is that missing required files will not be reported until task execution. This is because legacy processes have no way to declare whether a
pathinput is optional.For typed processes, optional file inputs are declared as
Path?and so can be validated prior to task execution. With this PR, anullparam value is allowed as long as the input is declared as optional.