我正在使用grape-swagger
gem,但无法在 Swagger 中正确描述基于 Grape 的 API。使用:grape (0.11.0)
和grape-swagger (0.10.1)
当我启用 Swagger json 列表时,我得到的输出列出了所有端点,但没有列出每个端点中包含的方法。
我的输出:
{
"apiVersion": "v0",
"swaggerVersion": "1.2",
"produces": [
"application/json"
],
"apis": [
{
"path": "/version.{format}",
"description": "Operations about versions"
},
{
"path": "/ping.{format}",
"description": "Operations about pings"
},
{
"path": "/users.{format}",
"description": "Operations about users"
},
{
"path": "/company.{format}",
"description": "Operations about companies"
},
{
"path": "/merchants.{format}",
"description": "Operations about merchants"
}
],
"info": {}
}
我还在 config.ru 中添加了 CORS 津贴,如下所示:
require 'rack/cors'
use Rack::Cors do
allow do
origins '*'
resource '*',
headers: :any,
methods: [:get, :post, :put, :delete, :options]
end
end
关于如何获取里面列出的每个端点的方法的任何线索?