ruby-grape / ruby-grape/grape

Route param information not being propagated to mounted APIs

Open
#1,619 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When mounting an API within a route_param, the attributes of the route param are not propagating downward in the route.params property.

Attaching a failing test. #1620

This seems to touch on #1177 as to what the documented behavior should be for mount. I would expect type information etc. to propagate down.

Note this has downstream effects; when we use grape-swagger and look at the documentation for the API, the parameter types are wrong for these route parameters (which I believe is https://github.com/ruby-grape/grape-swagger/issues/532) It always shows type of Integer, and does not display description information etc. I believe this is the root cause of that failure but cannot be sure.

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

Start with the failing test attached in #1620 and trace how route parameters appear in route.params when an API is mounted inside a route_param. Compare the behavior with the documented mount behavior discussed in #1177; done when parameter type and description metadata propagate and the failing test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.