Add mounted_app reader and app: keyword to Grape::Endpoint#2777
Open
ericproulx wants to merge 1 commit into
Open
Add mounted_app reader and app: keyword to Grape::Endpoint#2777ericproulx wants to merge 1 commit into
ericproulx wants to merge 1 commit into
Conversation
Danger ReportNo issues found. |
`app` (the Rack app or Grape API mounted at an endpoint) was reachable only by digging into the public options bag as `endpoint.options[:app]`. Introduce a first-class `mounted_app` reader (returning `config.app`, `nil` for a plain block endpoint) and accept `app:` as an explicit keyword on `Grape::Endpoint#initialize`. Grape's own mount-refresh dedup now reads `endpoint.mounted_app` instead of `options[:app]`. This is additive and non-breaking: `options[:app]` is still populated exactly as before for downstream consumers (e.g. grape-swagger), which can migrate to `mounted_app` before it is eventually dropped from the options Hash. Also adds the previously-missing coverage for the `refresh_already_mounted` dedup path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
63a6d3b to
ab97320
Compare
This was referenced Jul 4, 2026
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.
Summary
app(the Rack app or Grape API mounted at an endpoint) was only reachable by digging into the public options bag asendpoint.options[:app]. This is step 1 of moving it to a first-class accessor — additive and non-breaking.Changes
Grape::Endpoint#initializeacceptsapp:as an explicit keyword (was pulled from**options).Grape::Endpoint#mounted_appreader →config.app(the mounted app;nilfor a plain block endpoint).refresh_already_mounted) now readsendpoint.mounted_appinstead ofendpoint.options[:app].#mounted_appand for therefresh_already_mounteddedup path, which previously had none.Non-breaking
endpoint.options[:app]is still populated exactly as before (same object; key absent for plain endpoints), so grape-swagger and any external readers keep working. No deprecation warning yet.Why
mounted_app, notapp@appalready means the runnable Rack app (config.app || build_stack, invoked bycall). A publicappreturning the rawconfig.appwould benilfor ordinary block endpoints even though they're callable — confusing.mounted_appsays exactly what it is.Follow-ups (separate PRs)
endpoint.mounted_app/endpoint.endpoints.:appfrom the options Hash in a major, with an UPGRADING note.🤖 Generated with Claude Code