Skip to content

Add module schema v1.1 with stricter required fields#17

Draft
pditommaso wants to merge 1 commit into
mainfrom
module-v2-stricter-validation
Draft

Add module schema v1.1 with stricter required fields#17
pditommaso wants to merge 1 commit 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?

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>
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.

1 participant