Skip to content
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

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

Merged
merged 6 commits into from
Jan 9, 2025

Conversation

mirpedrol
Copy link
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.

Copy link
Contributor

@mashehu mashehu left a comment

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?

Copy link
Contributor

@mashehu mashehu left a comment

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?

Copy link

codecov bot commented Jan 8, 2025

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
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

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
88 checks passed
@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.

3 participants