nf-core / nf-core/tools

Schema: Support `anyOf`, `allOf` and `oneOf`

Open
#2,427 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

schema
Dominant language
Python
Stars
322
Forks
255
Avg merge
2d 3h
Merged PRs (30d)
5

Description

Description of feature

It's fairly common for parameters to be able to accept one of several input types. For example:

  • Either a specific string, or a number (auto or a float number between 0-1)
  • An --input flag can support inputs with multiple sample sheet schema

JSON Schema can natively support this kind of thing using anyOf. For example usage, see this ONT workflow schema.

More complex rules can be used with nested allOf and oneOf statements, eg. as done here .

Editing the Nextflow schema manually mostly works - validation within the pipeline uses off-the-shelf JSON schema libraries, so validation passes. However, our custom stack built on top of the Nextflow schema breaks horribly.

It would be good to explicitly support this behaviour. As with all schema extensions, this is across multiple locations:

  • nf-core schema build
  • nf-core schema lint
  • The web schema build UI
  • nf-core launch
  • The nf-core web launch UI & validation code
  • Pipeline template validation code (nextflow run ... )
  • Pipeline template help text (nextflow run ... --help)

This is an overview issue and each part of the above should be broken into its own issue / task.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by breaking the overview into separate tasks and tracing the implementations behind nf-core schema build, schema lint, nf-core launch, the web schema and launch UIs, and pipeline template validation and help. Done means anyOf, allOf, and oneOf are supported consistently across every checklist item, with each task having its own scope and verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.