Skip to content

Add missing validations for required fields to module schema v1#17

Merged
bentsherman merged 2 commits into
mainfrom
module-v2-stricter-validation
May 19, 2026
Merged

Add missing validations for required fields to module schema v1#17
bentsherman merged 2 commits into
mainfrom
module-v2-stricter-validation

Conversation

@pditommaso

Copy link
Copy Markdown
Member

Summary

Introduces module/v1.1/schema.json alongside the existing v1. The new revision tightens validation so that meta.yml files cannot be published with placeholder or incomplete metadata:

  • version and license are now required at the top level
  • version must match the semantic-versioning pattern (^\d+\.\d+\.\d+(-[\w.-]+)?$)
  • name must match the namespace/name (or nested) pattern
  • parameter description rejects the literal "TODO: Add description" placeholder emitted by nextflow module spec

Why now

In nextflow-io/nextflow#7094 the nextflow module validate command starts validating meta.yml against this JSON schema. v1 of the schema is weaker than the existing hand-coded checks in Nextflow, so those checks have to stay in code as a layer on top. v1.1 is the first step toward letting Nextflow remove those duplicated checks: once v1.1 is published and Nextflow points its default at it, the remaining hand-coded rules in ModuleSpec.validate() can be deleted.

Test plan

Five fixtures live under module/v1.1/tests/ and pass Draft202012Validator as expected:

fixture expected what it covers
valid_spec.yml pass full spec with all required fields and patterns
invalid_missing_fields.yml fail missing version and license
invalid_name.yml fail name is a bare fastqc (no namespace)
invalid_version.yml fail version: v1.0 (not semver)
invalid_todo_description.yml fail parameter description: "TODO: Add description"

Open questions

  • Branch name says v2 for historical reasons; the schema directory is v1.1. Happy to rename the branch if helpful.
  • Should we also tighten paramSpec.description to reject any TODO:-prefixed string instead of just the exact placeholder?

pditommaso and others added 2 commits April 30, 2026 17:07
Introduces module/v1.1/schema.json alongside the existing v1. The new
revision tightens validation so that meta.yml files cannot be published
with placeholder or incomplete metadata:

- `version` and `license` are now required at the top level
- `version` must match the semantic-versioning pattern
- `name` must match the `namespace/name` (or nested) pattern
- parameter `description` rejects the `"TODO: Add description"`
  placeholder emitted by `nextflow module spec`

Includes a valid fixture and four invalid fixtures covering each new
constraint under module/v1.1/tests/.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman bentsherman changed the title Add module schema v1.1 with stricter required fields Add missing validations for required field to module schema v1 May 19, 2026
@bentsherman bentsherman marked this pull request as ready for review May 19, 2026 17:08
@bentsherman bentsherman changed the title Add missing validations for required field to module schema v1 Add missing validations for required fields to module schema v1 May 19, 2026
@bentsherman bentsherman merged commit 4e6426a into main May 19, 2026
4 checks passed
@bentsherman bentsherman deleted the module-v2-stricter-validation branch May 19, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants