Skip to content

Does Not Handle Rails Optional Path Segments #878

@spaceraccoon

Description

@spaceraccoon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions