diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c772e8c0..e361c3dde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### General +- remove hard coded key prefix for schema in launcher ([#3432](https://github.com/nf-core/tools/pull/3432)) - output passed to write_params_file as Path object ([#3435](https://github.com/nf-core/tools/pull/3435)) - chore(deps): update python:3.12-slim docker digest to 69ce3ae ([#3433](https://github.com/nf-core/tools/pull/3433)) - chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.9.4 ([#3438](https://github.com/nf-core/tools/pull/3438)) diff --git a/nf_core/pipelines/launch.py b/nf_core/pipelines/launch.py index aab0ec428..364da1c11 100644 --- a/nf_core/pipelines/launch.py +++ b/nf_core/pipelines/launch.py @@ -406,10 +406,20 @@ def prompt_schema(self): """Go through the pipeline schema and prompt user to change defaults""" answers = {} # Start with the subschema in the definitions - use order of allOf - definitions_schemas = self.schema_obj.schema.get("$defs", self.schema_obj.schema.get("definitions", {})).items() + defs_notation = self.schema_obj.defs_notation + log.debug(f"defs_notation: {defs_notation}") + definitions_schemas = self.schema_obj.schema.get(defs_notation, {}) for allOf in self.schema_obj.schema.get("allOf", []): - d_key = allOf["$ref"][14:] - answers.update(self.prompt_group(d_key, definitions_schemas[d_key])) + # Extract the key from the $ref by removing the prefix + ref_value = allOf["$ref"] + prefix = f"#/{defs_notation}/" + d_key = ref_value[len(prefix) :] if ref_value.startswith(prefix) else ref_value + log.debug(f"d_key: {d_key}") + try: + answers.update(self.prompt_group(d_key, definitions_schemas[d_key])) + except KeyError: + log.warning(f"Could not find definition for {d_key}") + continue # Top level schema params for param_id, param_obj in self.schema_obj.schema.get("properties", {}).items():