Does nf-schema support writing schemas with condit...
# nf-schema
j
Does nf-schema support writing schemas with conditionals? e.g. using https://www.learnjsonschema.com/2020-12/applicator/if/
n
nf-schema does fully support the full draft2020-12 specifications. However, Seqera platform and nf-core tooling do not support that for the parameters schema
👍 1
j
This is for a samplesheet schema, so that wouldn't be a problem in this case. Might still be overkill mind you, but want to understand my options!
n
Yep in that case you are free to add as many conditionals as you want 😛
j
Now I just need to decide how much offloading of validation is worth pushing on to the schema and how much is better done inside the pipeline
n
I usually leave the complex validation to the pipeline code, mainly because it's easier to read and gives better error messages. Some simple conditionals (like checking required dependencies) are fine in the schema IMO
But it's up to you to decide where the line is on that one 😛
j
In this case I'm essentially writing a parameter schema as a sample schema - the idea is you can parameterise multiple genome assemblies referring to a core data input (separate schema). There are different genome assemblers, so ideally a specification for one assembler in an enum would only allow "parameters" for that assembler. I like the idea of a single source of truth for validation, but you're right about the complexity and the benefit of better error messages if you put it in the pipeline code
🚀 1
n
Yeah I fully agree with that! And that might be solved when validation will be incorporated into Nextflow itself
j
I managed to get some conditionals working using
dependentSchemas
. Seems like quite a nice way to do it, I can set
required
and
dependentRequired
for each assembler - extra keys for other assembly tools are still allowed, but I can just drop those in the pre-processing code.
n
Perfect! I love it when people try some of this crazy stuff with the schemas 😛