Swagger ui not working properly when using grape with versions
-
26-12-2019 - |
Question
If I load the content of 'http://local.myproject:3000/api/swagger'
The api endpoints are shown as '/api/0.1/activities.json' despite the fact that my version is 'V1'
version 'v1', using: :path do
mount TheLocker::Ping
...
Exactly by this reason when I push the 'Try it out!' button on the 'swagger ui' the request can't be executed because the version part of the api is not matching the actual one.
This is part of the message the swagger UI is displaying:
"No route matches [GET] "/api/0.1/activities.json""
Solution
Thanks @Peter Sorowka, you gave me a good hint to find the root of the problem.
Here: https://github.com/tim-vandecasteele/grape-swagger#configure it states that we can specify the version for the swagger to document.
So I needed to add the api_version: 'v1' to the mounting point:
add_swagger_documentation api_version: 'v1'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow