You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to discuss the "out of the box" compatibility of grape-swagger and grape-swagger-rails. It seems that when you install grape-swagger-rails (0.1.0) while using grape (0.11.0) and grape-swagger (0.10.1), you need to set options that aren't obvious from the README.
The first error I encountered was that when you setup grape-swagger-rails, there is an flash of errors that override each other and end with:
swagger_doc' from path http://api.rails-app.dev:3000/swagger_doc/swagger_doc.json (server returned undefined)
The other flashed errors are the same message but swagger_doc replaced with your resource. From the rails log, I was able to see that it was requesting a resource that was suffixed with .json
Started GET "/swagger_doc/swagger_doc.json" for 127.0.0.1 at 2015-04-03 16:14:20 -0700
ActionController::RoutingError (No route matches [GET] "/swagger_doc/swagger_doc.json"):
But out of the box, grape-swagger only creates urls of the form (notice no .json): /swagger_doc/swagger_doc
By changing add_swagger_documentation
to:
add_swagger_documentation(format: :json)
I was able to resolve the problem.
I propose that one or more of the following happens:
The README for grape-swagger is changed.
The README for grape-swagger-rails is changed.
The code in grape-swagger automatically assumes the format of :json.
Something better that the authors know. :)
I'm happy to send a PR anywhere for anything. I'm going to ping @dblock because he is so awesome and responds to everything grape related.
Because this issue hasn't been updated in over a year, I'm assuming it was resolved or is now not relevant. If this issue still exists in some form, please ping me here and I'll reopen it or open a new issue.
Hi,
I wanted to discuss the "out of the box" compatibility of grape-swagger and grape-swagger-rails. It seems that when you install grape-swagger-rails (0.1.0) while using grape (0.11.0) and grape-swagger (0.10.1), you need to set options that aren't obvious from the README.
The first error I encountered was that when you setup grape-swagger-rails, there is an flash of errors that override each other and end with:
swagger_doc' from path http://api.rails-app.dev:3000/swagger_doc/swagger_doc.json (server returned undefined)
The other flashed errors are the same message but
swagger_doc
replaced with your resource. From the rails log, I was able to see that it was requesting a resource that was suffixed with .jsonBut out of the box, grape-swagger only creates urls of the form (notice no .json):
/swagger_doc/swagger_doc
By changing
add_swagger_documentation
to:
add_swagger_documentation(format: :json)
I was able to resolve the problem.
I propose that one or more of the following happens:
:json
.I'm happy to send a PR anywhere for anything. I'm going to ping @dblock because he is so awesome and responds to everything grape related.
The following issues are relevant:
https://github.com/tim-vandecasteele/grape-swagger/issues/190
https://github.com/tim-vandecasteele/grape-swagger/issues/197
The text was updated successfully, but these errors were encountered: