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

Validate YAML file using schema before constructing module. #1560

Merged
merged 5 commits into from
Dec 15, 2023
Merged

Conversation

huard
Copy link
Collaborator

@huard huard commented Dec 14, 2023

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGES.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Use Yamale to validate schema before constructing module. Good news, no error found in the test suite.

Does this PR introduce a breaking change?

Other information:

There was an issue raised by @tlogan2000 about indicators accepting wrong arguments without failing. Could you post an offending example ?

CHANGES.rst Outdated Show resolved Hide resolved
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the docs Improvements to documenation label Dec 14, 2023
Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

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

Looks great!

I first thought that the other issue raised by @tlogan2000 was for yamls like this:

realm: atmos
indicators:
  tg:
    base: tg_mean
    parameters:
      frq: MS

where "frq" is misspelt. However, I just tested and this raises an error. So either the original error was fixed elsewhere, or the error was with the keys a level above, and this PR fixes it.

@github-actions github-actions bot added the approved Approved for additional tests label Dec 14, 2023
@huard
Copy link
Collaborator Author

huard commented Dec 14, 2023

Did you test it with or without this PR ?

@aulemahal
Copy link
Collaborator

With and without.

realm: atmos
indicators:
  tg:
    base: tg_mean
    parameters:
      frq: MS

fails on both, while

realm: atmos
indicators:
  tg:
    base: tg_mean
    parametrs:
      freq: MS

fails only here.

@huard
Copy link
Collaborator Author

huard commented Dec 14, 2023

Ok, let's merge this then and see if anything else comes up.

@huard
Copy link
Collaborator Author

huard commented Dec 14, 2023

Should we worry about the error in test_encoding ? This occurs in icclim.yml

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa5 in position 4213: illegal multibyte sequence

@huard
Copy link
Collaborator Author

huard commented Dec 14, 2023

C'est "≥" qui cause problème.

@huard huard merged commit 03a717d into master Dec 15, 2023
16 checks passed
@huard huard deleted the fix-1523 branch December 15, 2023 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests docs Improvements to documenation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate YAML using schema
3 participants