-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor configuration validation for improved reuse and consistency #412
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
Conversation
- Centralized validation logic into utilities (`init_settings`, `init_plugin_settings`, and `format_validation_errors`) for streamlined error handling. - Updated existing plugin configurations (`SpaceStatePluginConfig`, `StaticFilesPluginSettings`) to use shared validation utilities. - Introduced `split_camel_case` utility for formatting class names. - Removed redundant config validation code across multiple modules.
…notations - Replaced `BaseModel` with `BaseSettings` for settings classes to align with Pydantic's configuration handling. - Updated utilities (`init_settings`, `init_plugin_settings`, `format_validation_errors`) to use `BaseSettings_T` for improved clarity and type safety. - Centralized error collection type with new `CollectedErrors_T` alias. - Removed redundant imports and streamlined module dependencies.
…paths - Updated imports to use `utils` module consistently across configurations. - Removed unused `ValidationError` imports for cleaner dependencies. - Streamlined import paths in `StaticFilesPluginSettings`, `SpaceStatePluginConfig`, and `smib.config`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors configuration validation to improve code reusability and maintainability across the application. The changes centralize validation logic into shared utilities and apply them consistently to both core configuration modules and plugin configurations.
Key Changes:
- Created new utility functions (
init_settings,init_plugin_settings,format_validation_errors) to handle configuration validation in a standardized way - Added a
split_camel_casehelper function for improved formatting of class names in debug output - Refactored core configuration initialization to use the new utilities, eliminating repetitive try-catch blocks
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/smib/utilities/init.py | Added split_camel_case utility for parsing CamelCase strings |
| src/smib/config/utils.py | New module containing centralized validation utilities |
| src/smib/config/_types.py | Added type definitions for configuration validation |
| src/smib/config/init.py | Refactored to use new validation utilities and removed duplicate validation code |
| src/plugins/space/spacestate/config.py | Applied init_plugin_settings to replace manual validation |
| src/plugins/core/static.py | Applied init_plugin_settings to replace manual validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sjefferson99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Container builds and works correctly.
Overview
This pull request refactors the configuration validation workflow to enhance reusability and ensure consistent error handling. Changes include:
init_settings,init_plugin_settings,format_validation_errors).SpaceStatePluginConfigandStaticFilesPluginSettings).split_camel_caseutility for improved name parsing.