JSON params are documented with the invalid type "json"
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- json, ruby
- Domain
- documentation
Research direction
The bad type comes from GrapeSwagger::DocMethods::DataType.call, where JSON is lowercased alongside the primitive types, and from the request_primitives list that includes json. Read both to see how a JSON param reaches the spec as type json. Done when requires :a, type: JSON and Array[JSON] emit type object in both query and body definitions, with or without array_use_braces.
Written by the indexing model from the issue text.
Description
requires :a, type: Array[JSON] produces:
"a": { "type": "array", "items": { "type": "json" } }
A scalar requires :a, type: JSON does the same ("type": "json" in both query parameters and body definitions). json is not a valid Swagger 2.0 type, so the generated spec fails validation. The output is the same with or without array_use_braces.
Expected: a valid schema. The usual choice is type: object, as Hash already maps to object.
Probably in GrapeSwagger::DocMethods::DataType.call, where JSON is lowercased together with the primitive types, and request_primitives, which lists json.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 477
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from ruby-grape/grape-swagger
-
Support default_response and default in 2.3; stop reading route.descPossibly taken @numbata claimed this 58 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ruby-grape/grape-swagger#989 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ruby-grape/grape-swagger#987 · 3 comments ·
Maintainers usually reply within 1 day
-
Bug report: omitted array parameters with `array_use_braces: true`Possibly taken @olivier-thatch claimed this 532 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
ruby-grape/grape-swagger#952 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Bug Report: `default` for array params (`type: [String]`) is incorrectly placed inside `items`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
ruby-grape/grape-swagger#950 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Setting add_base_path without base_path explicitly specified, returned an errorPossibly taken @bekicot claimed this 841 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
ruby-grape/grape-swagger#935 ·
Maintainers usually reply within 1 day
All issues in ruby-grape/grape-swagger
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
riverqueue/river#1576 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
TheOdinProject/curriculum#31512 ·
Maintainers usually reply within 1 day
-
area/web interface
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day