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 configs based on most primitive JSON types #683

Merged
merged 16 commits into from
Jan 13, 2025

Conversation

maddenp-noaa
Copy link
Collaborator

Synopsis

Support validation (via CLI or API) of configs of bool, dict, float, int, list, or str types -- basically, all primitive JSON types except for null. Previously, validation of only dict-based configs was supported. Internally, driver and fs-mode configs remain dict-based, and for now YAMLConfig continues to support only dict-based configs, though this could be similarly generalized later.

A config value with str type was perviously interpreted as a path to a file containing the config data to validate, so supporting str-based configs required splitting the former config argument into config_data and config_path, where a str value passed in to the former represents the config data itself, and a str value passed in to the latter continues to represent a path to a file.

Type

  • Documentation
  • Enhancement (adds new functionality)

Impact

  • This is a breaking change (changes existing functionality)

Checklist

  • I have added myself and any co-authors to the PR's Assignees list.
  • I have reviewed the documentation and have made any updates necessitated by this change.

@maddenp-noaa maddenp-noaa self-assigned this Jan 8, 2025
docs/conf.py Show resolved Hide resolved
docs/sections/user_guide/api/config.rst Show resolved Hide resolved
src/uwtools/api/config.py Show resolved Hide resolved
src/uwtools/cli.py Show resolved Hide resolved
src/uwtools/config/formats/base.py Show resolved Hide resolved
src/uwtools/config/validator.py Show resolved Hide resolved
src/uwtools/config/validator.py Show resolved Hide resolved
src/uwtools/tests/api/test_config.py Show resolved Hide resolved
src/uwtools/tests/config/test_validator.py Show resolved Hide resolved
src/uwtools/tests/config/test_validator.py Show resolved Hide resolved
Copy link
Collaborator

@NaureenBharwaniNOAA NaureenBharwaniNOAA left a comment

Choose a reason for hiding this comment

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

This looks great!

@maddenp-noaa maddenp-noaa merged commit 087b1af into ufs-community:main Jan 13, 2025
2 checks passed
@maddenp-noaa maddenp-noaa deleted the validate-all-json-types branch January 13, 2025 15:01
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.

2 participants