ruby-grape / ruby-grape/grape-swagger
grape/swagger POST arrays with embedded params don't work correctly in the UI
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 479
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
code like this:
desc 'create new symptom'
params do
optional :id, type: Integer
requires :reasonCode, type: String
requires :lifeThreatening, type: Boolean
requires :msp, type: Boolean
optional :symptomNamesAttributes, type: Array, default: [] do
requires :name, type: String
requires :primary, type: Boolean, default: false
end
end
end
The area of interest is the SymtomNamesAttributes.
First problem: you can only enter one symtomNamesAttributes despite it being declared as an array.
Second (bigger problem): even though symtomNamesAttributes is marked as "optional", the UI makes it required because the nested names/primary fields are required.
Are these known issues? Is there a work around?
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 reported Grape parameter block in the Swagger UI, focusing on symptomNamesAttributes. Trace how the nested array and its required name/primary fields are represented. Done means the UI permits multiple array entries and does not require the optional nested parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100