Closed
Description
API v1
module Acme
class V1 < Grape::API
format :json
version [ 'v2', 'v1' ], using: :header, vendor: 'acme', format: :json, cascade: true
desc "Returns the current API version, v1."
get do
{ version: 'v1' }
end
desc "Returns pong."
get "ping" do
{ ping: "pong" }
end
end
end
API v2
module Acme
class V2 < Grape::API
format :json
version 'v2', using: :header, vendor: 'acme', format: :json, cascade: true
desc "Returns the current API version, v2."
get do
{ version: 'v2' }
end
end
end
We should be able to mount these in v2, then v1 order, like so:
Rack::Cascade.new([ Acme::V2, Acme::V1 ])
Then V2 will respond to API requests that it implements, and V1 will respond to anything remaining, since it also supports v2.
Metadata
Metadata
Assignees
Labels
No labels