Skip to content

Parameters schema validation: allow oneOf, anyOf and allOf with required#3386

Merged
mirpedrol merged 6 commits into
nf-core:devfrom
mirpedrol:schema-allow-oneof-anyof-allof
Jan 9, 2025
Merged

Parameters schema validation: allow oneOf, anyOf and allOf with required#3386
mirpedrol merged 6 commits into
nf-core:devfrom
mirpedrol:schema-allow-oneof-anyof-allof

Conversation

@mirpedrol

Copy link
Copy Markdown
Member

I found a case where we were using the following schema structure:

"oneOf": [{ "required": ["param_1"] }, { "required": ["param_2", "param_3"] }],

This was failing because our listing wasn't removing the required instances inside the oneOf when validating default parameter values.
This PR allows having these cases and also prints the complete error message on debug mode, as the e.message text was not helpful in identifying the problem.

@mashehu mashehu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a lot of repeated code. Can we maybe handle all three cases in one abstract way?

@mashehu mashehu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also maybe tests for all of these?

@codecov

codecov Bot commented Jan 8, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 13.63636% with 19 lines in your changes missing coverage. Please review.

Project coverage is 75.80%. Comparing base (011d15a) to head (958f58e).

Files with missing lines Patch % Lines
nf_core/pipelines/schema.py 13.63% 19 Missing ⚠️
Additional details and impacted files

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mirpedrol

Copy link
Copy Markdown
Member Author

Tests added ✅
I have reduced the code for the three keywords but I had to add it to the top level too

@mashehu mashehu requested a review from Copilot January 8, 2025 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

@mirpedrol mirpedrol merged commit b685800 into nf-core:dev Jan 9, 2025
@mirpedrol mirpedrol deleted the schema-allow-oneof-anyof-allof branch January 9, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants