ruby-grape / ruby-grape/grape

Use custom middleware only for special routes

Open
#712 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

Hi,

at the moment when you use the use statement you include your middleware for the actual namespace and childrens of your namespace. For some middlewares thats not what you want. For instance authentication middleware should only be included for your current route or up to the end of your namespace.

I think it would be nice do extend the use statement with an option to configure the scope
to which this middleware should be applied.

A block for use can't be used because this block is applied to the middleware class.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named, so first locate the use statement and middleware scope handling in the repository. Clarify the intended route and namespace boundaries, then verify that a configurable scope limits middleware to the requested routes without affecting unintended children.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.