ruby-grape / ruby-grape/grape

default_error_status does not inherit from its mounted parent

Open
#1,177 4 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

class Api::Base < Grape::API
  default_error_status 400

  mount Api::Status
end

error! inside Api::Status would respond with 500

It's not very clear, some of the configs are inherited when mounted, and some like default_error_status are not.

Grape tutorials suggest using 'Defaults' concern which is included in each api class. That looks strange to have such complexity for such simple use case of inheriting options

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 by tracing how mount handles configuration inheritance between Api::Base and Api::Status, focusing on default_error_status and error!. Compare this behavior with the other configurations that are inherited when mounted. Done means error! inside the mounted API responds with the parent’s configured 400 status, with coverage for the mounted case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.