문제

I'm using Grape (on Rails 4), Swagger and Swagger-UI to document my Grape API. Now I wonder how to group routes like the Swagger example: http://petstore.swagger.wordnik.com/

Thats how my Swagger-UI currently looks:

enter image description here

도움이 되었습니까?

해결책

If you define your endpoint within a resource block, for example:

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

... you will see this nice separators:

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top