Skip to content

before_typecast & validates_raw#14

Merged
Syati merged 12 commits intomainfrom
feature/raw_validation
Apr 2, 2026
Merged

before_typecast & validates_raw#14
Syati merged 12 commits intomainfrom
feature/raw_validation

Conversation

@Syati
Copy link
Copy Markdown
Owner

@Syati Syati commented Apr 2, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 2, 2026 19:50
Copy link
Copy Markdown
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

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::AttributeMethods to generate *_before_type_cast accessors per declared attribute.
  • Introduces StructuredParams::Validations#validates_raw to 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.

Repository owner deleted a comment from chatgpt-codex-connector bot Apr 2, 2026
@Syati
Copy link
Copy Markdown
Owner Author

Syati commented Apr 2, 2026

@codex[agent]

@Codex Codex AI changed the title Enhance StructuredParams with validation and operational guide Addressing PR comments Apr 2, 2026
@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Updated the combined-validation example in docs/validation.md to avoid implying that typed validation errors are always produced for score: 'abc'; the comment now explicitly says typed errors may appear depending on caster/validator behavior. docs/validation.mdL59-L63
  • Clarified the explanatory text to state that typed validators run on cast values, so failure behavior depends on type-casting and validator options for a given raw input. docs/validation.mdL65-L67
  • Committed the change on the current branch (e2c8beb) and created a follow-up PR message via the make_pr tool.

Testing

  • ⚠️ bundle exec rspec spec/validations_spec.rb (failed in this environment because rspec executable is not installed: bundler: command not found: rspec)

View task →

@Syati Syati self-assigned this Apr 2, 2026
@Syati Syati merged commit 4f30dd9 into main Apr 2, 2026
10 checks passed
@Syati Syati deleted the feature/raw_validation branch April 2, 2026 21:05
@Syati Syati changed the title Addressing PR comments before_typecast & raw_validation Apr 2, 2026
@Syati Syati changed the title before_typecast & raw_validation before_typecast & validates_raw Apr 2, 2026
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