ruby-grape / grape-swagger

Add OAPI/swagger v2.0 compliant documentation to your grape API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not detect Wildcard Segments as Path Parameters

spaceraccoon opened this issue · comments

Ruby on Rails supports wildcard segments, such as:

get 'books/*section/:title'

would match books/some/section/last-words-a-memoir with params[:section] equals 'some/section', and params[:title] equals 'last-words-a-memoir'.

However, grape-swagger does not recognise these wildcard segments as path parameters. For example:

get 'books/*section/:title' 

would generate:

"paths": {
  "/api/v2/books/*section/{title}": {
    "get": {
    ...
      "parameters": [
         {
           "in": "query", "name": "*section"
           ...
  }
}

instead of the expected:

"paths": {
  "/api/v2/books/{section}/{title}": {
    "get": {
    ...
      "parameters": [
         {
           "in": "path", "name": "section"
           ...
  }
}

grape-swagger should also recognise wildcard segments as path parameters.