Add module schema v1.1 with stricter required fields#17
Draft
pditommaso wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
module/v1.1/schema.jsonalongside the existingv1. The new revision tightens validation so thatmeta.ymlfiles cannot be published with placeholder or incomplete metadata:versionandlicenseare now required at the top levelversionmust match the semantic-versioning pattern (^\d+\.\d+\.\d+(-[\w.-]+)?$)namemust match thenamespace/name(or nested) patterndescriptionrejects the literal"TODO: Add description"placeholder emitted bynextflow module specWhy now
In nextflow-io/nextflow#7094 the
nextflow module validatecommand starts validatingmeta.ymlagainst 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 inModuleSpec.validate()can be deleted.Test plan
Five fixtures live under
module/v1.1/tests/and passDraft202012Validatoras expected:valid_spec.ymlinvalid_missing_fields.ymlversionandlicenseinvalid_name.ymlnameis a barefastqc(no namespace)invalid_version.ymlversion: v1.0(not semver)invalid_todo_description.ymldescription: "TODO: Add description"Open questions
v2for historical reasons; the schema directory isv1.1. Happy to rename the branch if helpful.paramSpec.descriptionto reject anyTODO:-prefixed string instead of just the exact placeholder?