Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions modules/nf-lang/src/main/java/nextflow/config/spec/SpecNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ else if( fqName.startsWith("nextflow.preview.") )
* process directives.
*
* Directives with multiple method overloads are treated as
* options with multiple supported types. Method overloads with
* multiple parameters are ignored because they are not supported
* in the configuration.
* options with multiple supported types. Only one overload needs
* to provide a description. Method overloads with multiple parameters
* are ignored because they are not supported in the configuration.
*/
private static SpecNode processScope() {
var description = """
Expand All @@ -94,13 +94,14 @@ private static SpecNode processScope() {
for( var method : ProcessDsl.DirectiveDsl.class.getDeclaredMethods() ) {
if( method.getParameters().length != 1 )
continue;
if( !children.containsKey(method.getName()) ) {
var desc = annotatedDescription(method, "");
children.put(method.getName(), new Option(desc, new ArrayList<>()));
}
var option = (Option) children.get(method.getName());
var paramType = method.getParameterTypes()[0];
option.types.add(paramType);
var name = method.getName();
var desc = annotatedDescription(method, "");
var option = (Option) children.get(name);
if( option == null )
children.put(name, option = new Option(desc, new ArrayList<>()));
else if( option.description().isEmpty() && !desc.isEmpty() )
children.put(name, option = new Option(desc, option.types()));
option.types.add(method.getParameterTypes()[0]);
}
return new Scope(description, children);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class SpecNodeTest extends Specification {
def scope = SpecNode.ROOT.children.get('process')

expect:
// every directive should have a description, even if it is overloaded
scope.children.get('arch').description
scope.children.get('cache').description
scope.children.get('clusterOptions').description
scope.children.get('cpus').description
scope.children.get('disk').description
scope.children.get('publishDir').description
and:
scope.children.get('clusterOptions').types as Set == [ String, List, String[] ] as Set
scope.children.get('cpus').types == [ Integer ]
scope.children.get('errorStrategy').types == [ String ]
Expand Down
Loading