Support validation of collection params with record types#7025
Support validation of collection params with record types#7025bentsherman wants to merge 3 commits intomasterfrom
Conversation
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
|
Suggestion from AI review: 1. Null-safety bug in TypeHelper.asType for nullable Path fields In modules/nf-commons/src/main/nextflow/util/TypeHelper.groovy, if a record has a nullable Path field (e.g., fastq_2: Path?) and the input value is null, then value.toString() at line ~99 will throw a 2. No unit tests for TypeHelper conversion methods getRawType, isCollectionType, asType, asCollectionType, and asRecordType have no dedicated unit tests — only tested indirectly through ParamsDslTest. Given these methods handle type reflection and conversion (prone 3. No test for @nullable annotation propagation There's no test verifying that a ?-suffixed record field actually gets the @nullable annotation at runtime, or that asRecordType correctly allows missing values for nullable fields. Only the rejection path |
|
|
||
| - Replacing `nextflow_schema.json` -- while the `params` block addresses many of the same needs, existing pipelines that use a JSON Schema should not be required to migrate. A native integration with `nextflow_schema.json` can be explored in the future. | ||
|
|
||
| - Supporting nested params -- the `params` block only supports a flat list of params. Nested params can still be used in the config, but they do not have first-class support at this time. |
There was a problem hiding this comment.
Record types are considered nested params, right? I mean , can I define a param as a Record type such as the following?:
params {
meta : Metadata
}
record Metadata {
id: String
....
}
This PR extends the support for loading a collection-type param from a CSV/JSON/YAML file to also validate and convert against a record type when used.
Notable changes:
paramsblock as a hidden class to preserve runtime type information@Nullableannotation to model nullable record fields at runtimeTypeshelper class to render parameterized types