diff --git a/modules/nf-lang/src/main/java/nextflow/config/spec/SpecNode.java b/modules/nf-lang/src/main/java/nextflow/config/spec/SpecNode.java index 2e3b0717d4..4c22a4982a 100644 --- a/modules/nf-lang/src/main/java/nextflow/config/spec/SpecNode.java +++ b/modules/nf-lang/src/main/java/nextflow/config/spec/SpecNode.java @@ -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 = """ @@ -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); } diff --git a/modules/nf-lang/src/test/groovy/nextflow/config/spec/SpecNodeTest.groovy b/modules/nf-lang/src/test/groovy/nextflow/config/spec/SpecNodeTest.groovy index 2cb43c29ec..1ce692ee36 100644 --- a/modules/nf-lang/src/test/groovy/nextflow/config/spec/SpecNodeTest.groovy +++ b/modules/nf-lang/src/test/groovy/nextflow/config/spec/SpecNodeTest.groovy @@ -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 ]