Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Not Handle Rails Optional Path Segments #878

Open
spaceraccoon opened this issue Nov 10, 2022 · 0 comments
Open

Does Not Handle Rails Optional Path Segments #878

spaceraccoon opened this issue Nov 10, 2022 · 0 comments

Comments

@spaceraccoon
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant