ruby-grape / ruby-grape/grape-swagger
Does Not Handle Rails Optional Path Segments
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 479
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Ruby on Rails supports optional path segments, such as:
get 'photos(/:id)'
would match both photos/:id and photos paths.
However, grape-swagger does not recognise these optional path segments. For example:
get 'photos(/:id)'
would generate:
"paths": {
"/api/v2/photos(/{id})": {
"get": {
...
"parameters": [
{
"in": "path", "name": "id"
...
}
}
instead of the expected:
"paths": {
"/api/v2/photos": {
"get": {
...
}
...
"/api/v2/photos/{id}": {
"get": {
...
"parameters": [
{
"in": "path", "name": "id"
...
}
}
grape-swagger should also handle Rails optional path segments in a predictable manner.
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 with the Rails optional path-segment example in the issue and trace how grape-swagger turns that route into OpenAPI paths. Verify that the generated output represents both /api/v2/photos and /api/v2/photos/{id}, with the id parameter retained only on the parameterized path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, rails, ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100