Skip to content

Document type: Presenter with explicit input validation - #48

Merged
dblock merged 1 commit into
ruby-grape:masterfrom
dblock:docs/presenter-parameter-types-9
Oct 27, 2026
Merged

dblock merged 1 commit into
ruby-grape:masterfrom
dblock:docs/presenter-parameter-types-9

Conversation

@dblock

@dblock dblock commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #9.

Provide a tested application-local input decorator implementing Grape’s existing .parse contract, allowing exactly type: Presenter. Explicitly validate incoming shapes and required nonblank values, allowlist writable fields through Roar, and return the decorator rather than from_hash’s model result so Grape’s type check succeeds.

Execute the exact README example in actual JSON requests. Cover valid coercion, undeclared properties, malformed/incomplete input, blank titles, and missing parameters; invalid input returns 400 before model construction. No automatic schema inference, generic model constructor, or runtime API changes.

Keep test bundles on JSON 2.x for Ruby older than 3.2, whose compatible MultiJson versions use JSON.load options removed in JSON 3. Verify the complete suite and lint on Ruby 2.7/Grape 1.8 as well as Ruby 4/Grape 4; modern bundles continue exercising JSON 3. This same prerequisite is included in #49 so each PR works independently.

AI-authored on behalf of @dblock.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@dblock
dblock force-pushed the docs/presenter-parameter-types-9 branch 2 times, most recently from 9309761 to 9a597f6 Compare October 27, 2026 10:43
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock
dblock force-pushed the docs/presenter-parameter-types-9 branch from 9a597f6 to fe431d1 Compare October 27, 2026 11:30
@dblock
dblock merged commit e7f502e into ruby-grape:master Oct 27, 2026
25 checks passed
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.

Enable type: presenter with Grape

1 participant