Skip to content

Normalize Endpoint constructor inputs into an internal Data value object#2735

Open
ericproulx wants to merge 1 commit into
masterfrom
refactor/endpoint-options-data
Open

Normalize Endpoint constructor inputs into an internal Data value object#2735
ericproulx wants to merge 1 commit into
masterfrom
refactor/endpoint-options-data

Conversation

@ericproulx
Copy link
Copy Markdown
Contributor

Stacked on top of #2734.

Summary

  • Introduces Grape::Endpoint::Options, a Data.define value object built once from the **options Hash in Endpoint#initialize. Internal call sites read named accessors (config.path, config.app, etc.) instead of poking @options[:...].
  • Public surface unchanged: Endpoint.new(new_settings, **options, &block) still takes a Hash, and attr_reader :options still returns that Hash — so downstream gems (e.g. grape-swagger) that read endpoint.options[:app] continue to work.
  • :method is renamed to :http_methods on the value object to avoid shadowing Object#method via the generated Data accessor.

Test plan

  • bundle exec rspec — 2313 examples, 0 failures
  • bundle exec rubocop — clean on touched files
  • CI green

🤖 Generated with Claude Code

@ericproulx ericproulx force-pushed the refactor/endpoint-options-data branch from c7bbd51 to e797ee6 Compare May 23, 2026 08:18
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 23, 2026

Danger Report

No issues found.

View run

@ericproulx ericproulx force-pushed the refactor/endpoint-options-data branch 2 times, most recently from 1c8b6c0 to 7928ac5 Compare May 23, 2026 16:41
@ericproulx ericproulx requested a review from dblock May 23, 2026 17:40
Base automatically changed from refactor/endpoint-options-route-enabled to master May 25, 2026 20:28
…lue object

Introduces `Grape::Endpoint::Options`, a `Data.define` value object built
once from the `**options` Hash in `Endpoint#initialize`. Internal call
sites read named accessors (`config.path`, `config.app`, etc.) instead
of poking `@options[:...]`.

The public surface is unchanged: `Endpoint.new(new_settings, **options, &block)`
still takes a Hash, and `attr_reader :options` still returns that Hash —
so downstream gems (e.g. grape-swagger) that read `endpoint.options[:app]`
continue to work.

`:method` is renamed to `:http_methods` on the value object to avoid
shadowing `Object#method` via the generated Data accessor.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ericproulx ericproulx force-pushed the refactor/endpoint-options-data branch from 7928ac5 to 0555ad2 Compare May 26, 2026 18:50
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