Improve error handling and serialization features#1
Merged
Conversation
…and strong parameters integration
…n, and messages methods
Contributor
There was a problem hiding this comment.
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, andmessagesmethods - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the changes
This pull request introduces the following enhancements and refactorings:
to_hash,as_json, andmessagesmethods.to_hashmethod to use symbols for keys in nested error structures and configured it to support structured options.StructuredParams.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