2

我正在使用 Grape(在 Rails 4 上)、Swagger 和 Swagger-UI 来记录我的 Grape API。现在我想知道如何像 Swagger 示例那样对路线进行分组:http: //petstore.swagger.wordnik.com/

这就是我的 Swagger-UI 当前的外观:

在此处输入图像描述

4

1 回答 1

2

如果您在resource块中定义端点,例如:

module MyApiModule
  class MyApiClass < Grape::API

    resource :foo do
      get :time do
        {epoch_time: Time.now.to_i.to_s}
      end
    end

    resource :bar do
      get :bar_time do
        {epoch_bar_time: Time.now.to_i.to_s}
      end
    end
  end
end

...你会看到这个漂亮的分隔符:

在此处输入图像描述

于 2013-12-07T11:46:07.623 回答