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 に答える