-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema: Support nested parameters (objects) #1554
Comments
Hi @ewels , thanks for raising this issue. I understand the challenge of implementing the nested schema, especially from a UI point of view. And I also echo the concern of having infinite nesting. For me, having the ability to define separate objects in params is good enough. I think it would be a useful addition to the Tower interface with minimal destruction. And I would argue that rarely would anyone nest objects more than once. Also, the current tower schema interface actually supports the nesting. It's only the side menu that's a bit broken. When I manually created the nested object, the content renders correctly: Only the side menu has some glitches when you scroll to the nested part: The main reason to have objects in my params is to better organize params, and to allow duplicate names. e.g. ( Btw, this may be an unpopular opinion, but I think the current schema is a bit confusing, since it enforces an object structure. Although the current paradigm requires a flattened params structure, all pipeline params has to be inside an object. I feel this restriction is a bit unnecessary (there might be other reasons I'm not aware of). And it actually tripped me when I'm learning to use tower schema, since intuitively I would put the params at the top level, and nested params as an object. I understand that it may break a lot of things should we decide to change this behavior. But it would simplify the UI a little bit and the nested objects would look more natural. |
Ah so Tower does already support it a bit? Interesting! Does parameter validation / launch work and everything?
I don't quite understand this sorry.. As opposed to what?
Yeah I struggled with this a bit when I was first writing it. It's because we're validating I mostly feel that no-one should ever need to edit the JSON manually, so it doesn't bother me too much. Usually when people do directly edit the JSON it's either because they don't know |
Thanks for your reply @ewels . Please see inline comment:
Yes, only the UI is a little broken. But validation works and the params are passed correctly.
Compared to having lists, which is also nice to have. We use it a lot in our pipelines. But I understand the challenge from the Tower UI side. |
Should include support for arrays as well as objects. Similar logic applies to both. [Edit: Tracked in #3392 ] |
@bentsherman has called into question future support of nested parameters, so this issue should be put on hold until that's figured out. If you'd like nested parameters, please join the Slack discussion thread to voice your opinion. |
Based on discussions in Slack, what I'm leaning toward is to allow a "map" param which can only be specified as a single map, and overriding the param overrides the entire map (no deep nesting). The nested params support in nf-schema can then be used to validate the map param as is done for structured files (e.g. samplesheet). So you can still have name and type checking on the map param, but in the script it's just a regular map. We may be able to expand on this further as we evolve the Nextflow language |
Nested parameters are now supported in nf-schema, as of v2.1.0: https://nextflow-io.github.io/nf-schema/latest/nextflow_schema/nextflow_schema_specification/#nested-parameters We should add support for these everywhere else in the Nextflow parameter schema world. |
Nested parameters (objects)
The current iteration of the
nextflow_schema.json
file does not support nested parameters. It doesn't break, it simply ignores them. This was a conscious decision to limit the complexity and scope when building the schema, but does limit its power.It would be good to support nested parameters, for example from
-with-params example.yml
:The schema structure / format itself should not need modification. It's a case of adding support for the type
object
. For example (simplified):Arrays
See #3392
Implication
Although the schema itself should be fine, there is a lot of code that interacts with the schema. All of the following will need to be updated:
nf-core schema build
nf-core schema lint
nf-core launch
nextflow run ...
)nextflow run ... --help
)I'm hoping that the parameter validation part will be relatively simple, as we are mostly using off-the-shelf JSON Schema libraries to do this. However, anything involving a UI will need quite a bit of thought.
This is an overview issue and each part of the above should be broken into its own issue / task.
The text was updated successfully, but these errors were encountered: