ruby-grape / ruby-grape/grape

Add mutually_exclusive groups.

Open
#1,614 3 comments 2 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

Some APIs have mutually exclusive groups.

optional :widget_id
optional :gadget_id
optional :gadget_type
mutually_exclusive :widget_id, gadget_id
mutually_exclusive :widget_id, gadget_type
get do

end

This gets out of control with a third mutually exclusive combination of options. We might want to write something like this.

optional :widget_id
group :gadget do
  optional :gadget_id
  optional :gadget_type
end
mutually_exclusive :widget, :gadget
get do

end

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 reviewing the existing mutually_exclusive and option-group entry points, then compare them with the proposed group :gadget syntax. Done means grouped options can be declared and the group can participate in mutually exclusive validation as shown in the examples.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.