Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support in structured_params for validating raw (pre-type-cast) input via a new validates_raw API, backed by *_before_type_cast readers and documented usage guidance.
Changes:
- Introduces
StructuredParams::AttributeMethodsto generate*_before_type_castaccessors per declared attribute. - Introduces
StructuredParams::Validations#validates_rawto validate against raw values and remap errors back to the original attribute. - Expands documentation (EN/JA + docs) and adds RSpec coverage + generated RBS signatures.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/structured_params/attribute_methods.rb | Adds *_before_type_cast reader generation when attributes are declared. |
| lib/structured_params/validations.rb | Adds validates_raw and an after-validation callback to remap before-type-cast errors. |
| lib/structured_params/params.rb | Mixes in the new AttributeMethods + Validations modules into Params. |
| lib/structured_params.rb | Requires the new modules so they load with the gem entrypoint. |
| spec/attribute_methods_spec.rb | Adds specs verifying before-type-cast readers return raw input. |
| spec/validations_spec.rb | Adds specs covering validates_raw behavior and error remapping across scenarios. |
| spec/params_spec.rb | Adds integration-ish coverage for raw validations via #valid?. |
| spec/support/test_classes.rb | Adds StrictAgeParameter support class used by raw-validation specs. |
| docs/validation.md | Documents validates_raw, including examples for combining raw + typed validations. |
| README.md | Adds a quickstart snippet demonstrating validates_raw usage. |
| README_ja.md | Adds Japanese README coverage for validates_raw usage. |
| AGENTS.md | Adds contributor/agent operational guidance (commands, repo layout, rules). |
| .agents/skills/rspec/SKILL.md | Adds an “rspec” skill doc with suggested workflows/commands. |
| sig/structured_params/attribute_methods.rbs | Generated RBS for AttributeMethods module. |
| sig/structured_params/validations.rbs | Generated RBS for Validations module. |
| sig/structured_params/params.rbs | Updates Params RBS to include the new modules + doc example. |
| .codex/config.toml | Adds codex approval/sandbox configuration. |
Owner
Author
Summary
Testing
|
…rb and validations.rbs
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.
No description provided.