exactly_one_of seems not work for nested parameters
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
Hello,
I'm currently creating an API with the latest version(0.14.0) but exactly_one_of doesn't work as expected for nested parameters.
Here is the sample.
params do
optional :additionalFacets, type: Hash do
requires: label, type: String
requires: facet, type: Hash do
requires :field, type: String
requires :type, type: String
optional :limit, type: Integer
optional :start, type: Integer
exactly_one_of :limit, :start
end
end
end
In this case I meant the validation of exactly_one_of works only when additionalFacets are given.
But it works when it is not given as well.
Can you help check this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the nested-parameter example from the issue with Grape 0.14.0 and trace the exactly_one_of validation entry point. Done means exactly_one_of is enforced when additionalFacets is supplied, but is not triggered when that optional parent parameter is absent; add a regression test for both cases.
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
- Clearly specified
- Newbie friendliness
- 45/100