So I came to this error when using Swagger UI and trying to hit the API.
Uncaught TypeError: Cannot read property 'definitions' of null
I'm using the gem grape-swagger
and the UI says is trying to retrieve the records.
Issue was, another member of the team had commented the line
add_swagger_documentation api_version: 'v1', mount_path: '/docs'
that must be placed in the class AFTER all the mounted APIs
class Root < Grape::API
blah blah blah...
mount BLAH::BLAH
mount FOO::BAR
add_swagger_documentation api_version: 'v1', mount_path: '/docs'
end
After putting it there again it worked!