Skip to content

Improve error handling and serialization features#1

Merged
Syati merged 11 commits intomainfrom
error_format
Sep 5, 2025
Merged

Improve error handling and serialization features#1
Syati merged 11 commits intomainfrom
error_format

Conversation

@Syati
Copy link
Owner

@Syati Syati commented Sep 5, 2025

Description of the changes

This pull request introduces the following enhancements and refactorings:

  • Enhanced error handling with structured options for to_hash, as_json, and messages methods.
  • Added documentation covering advanced usage, error handling, serialization, and integration with strong parameters.
  • Refactored to_hash method to use symbols for keys in nested error structures and configured it to support structured options.
  • Added custom key transformation and error handling for nested attributes using StructuredParams.
  • Refactored error handling logic to comply with RuboCop standards and introduced optional boolean parameter validations.
  • Developed a new error formatting module that supports JSON Pointer references.

Why these changes are introduced

The changes improve the robustness and flexibility of error handling, particularly for complex nested structures. They also ensure better integration with advanced features like strong parameters and enhance user support with improved documentation.

Additional notes

  • These changes ensure compliance with coding standards and enhance readability.
  • No breaking changes have been introduced.

Copilot AI review requested due to automatic review settings September 5, 2025 06:04
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 introduces enhanced error handling and serialization features for StructuredParams, including a new custom Errors class with structured error formatting capabilities, improved documentation, and refactored internal methods to better support nested structures.

  • Enhanced error handling with structured/flat format options for to_hash, as_json, and messages methods
  • Added comprehensive documentation covering installation, usage, validation, serialization, and integration patterns
  • Refactored parameter validation logic to use symbols consistently and improved error path formatting

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/errors_spec.rb New comprehensive test suite for the custom Errors class
sig/structured_params/params.rbs Updated type signatures for refactored parameter validation methods
sig/structured_params/errors.rbs New type definitions for the custom Errors class
sig/structured_params.rbs New type definitions for the main module
lib/structured_params/params.rb Refactored validation methods and error handling logic
lib/structured_params/errors.rb New custom Errors class with structured formatting support
lib/structured_params.rb Added errors module import and updated type registration
docs/* New comprehensive documentation files
README.md Streamlined README with links to detailed documentation
README_ja.md Updated Japanese README with same improvements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Syati Syati merged commit b7bb967 into main Sep 5, 2025
3 checks passed
@Syati Syati deleted the error_format branch September 5, 2025 06:23
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