Validate module spec against JSON schema#7094
Open
pditommaso wants to merge 1 commit intomasterfrom
Open
Conversation
Add formal JSON Schema validation for `nextflow module validate`, backed by the upstream Nextflow module schema. Schema validation runs between structure and Nextflow-specific spec checks, and overlapping hand-coded checks (name/description required, per-param type/description required, TODO type placeholder) are removed in favour of the schema as single source of truth. A `--schema` flag accepts a remote URL, a `file:` URI, or a local path to override the default schema location; load failures abort with a clear error. Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
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
nextflow module validatenow formally validatesmeta.ymlagainst the upstream module JSON schema (nextflow-io/schemas/main/module/v1/schema.json) usingcom.networknt:json-schema-validator.name/descriptionrequired, per-paramtype/descriptionrequired,TODO_TYPEplaceholder) are removed — the schema is the single source of truth for those rules. Checks the current schema does not cover stay inModuleSpec.validate():version/licenserequired, semver pattern,namespace/nameregex, and theTODO_DESCRIPTIONplaceholder.--schema <url-or-path>flag onnextflow module validateto override the default schema location. Accepts anhttp(s)://URL, afile:URI, or a local file path.--schemaas the escape hatch.A follow-up PR against
nextflow-io/schemaswill tighten the schema (requireversion/license, add the semver and namespace/name patterns, rejectTODO_DESCRIPTION) so the remaining hand-coded checks can also be removed.Test plan
./gradlew :nextflow:test --tests 'nextflow.module.ModuleSpecTest' --tests 'nextflow.module.ModuleSpecFactoryTest' --tests 'nextflow.module.ModuleSchemaValidatorTest' --tests 'nextflow.cli.module.CmdModuleValidateTest'— all greenModuleSchemaValidatorTest: pass, missing required field, invalid enum value,file:URI schema, hard-fail on missing schemaCmdModuleValidateTestrewritten to use a hermetic local schema fixture (no network in CI) and to split the missing-fields case into schema-level vs. nextflow-only scenariosnextflow module validate <module>against a real modulenextflow module validate <module> --schema ./local-schema.json