Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@samcorky
Copy link
Contributor

Overview

This pull request refactors the configuration validation workflow to enhance reusability and ensure consistent error handling. Changes include:

  • Centralizing validation logic in utility functions (init_settings, init_plugin_settings, format_validation_errors).
  • Applying shared validation utilities to existing plugin configurations (e.g., SpaceStatePluginConfig and StaticFilesPluginSettings).
  • Adding a split_camel_case utility for improved name parsing.
  • Removing redundant validation code across modules to streamline the codebase.

- 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.
@samcorky samcorky requested a review from sjefferson99 October 15, 2025 21:51
@samcorky samcorky linked an issue Oct 15, 2025 that may be closed by this pull request
…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`.
@sjefferson99 sjefferson99 requested a review from Copilot October 16, 2025 12:22
Copy link
Contributor

Copilot AI left a 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_case helper 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.

Copy link
Member

@sjefferson99 sjefferson99 left a 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.

@samcorky samcorky merged commit 30ebad1 into master Oct 19, 2025
@samcorky samcorky deleted the 387-dry-out-config-validation branch October 19, 2025 19:17
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.

DRY out Config Validation

3 participants