Grape: API version can't take an array of versions on 0.16.2

Created on 16 May 2016  路  4Comments  路  Source: ruby-grape/grape

This code works

 version 'v1', using: :path, vendor: 'api'
    resource :test do
      desc "Returns pong."
      get "ping" do
        { ping: "pong" }
      end
    end

This code doesn't work but it can work on 0.15.0

 version %w(v2 v1), using: :path, vendor: 'api'
    resource :test do
      desc "Returns pong."
      get "ping" do
        { ping: "pong" }
      end
    end

Started GET "/api/v1/test/ping" for ::1 at 2016-05-16 18:50:34 +0700

ActionController::RoutingError (No route matches [GET] "/api/v1/test/ping"):
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' web-console (2.2.1) lib/web_console/middleware.rb:39:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in call' railties (4.2.0) lib/rails/rack/logger.rb:38:incall_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in block in call' activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:inblock in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in tagged' activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:intagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:incall_with_quiet_assets'
request_store (1.2.0) lib/request_store/middleware.rb:8:in call' actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:incall'
rack (1.6.4) lib/rack/methodoverride.rb:22:in call' rack (1.6.4) lib/rack/runtime.rb:18:incall'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call' rack (1.6.4) lib/rack/lock.rb:17:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in call' rack (1.6.4) lib/rack/sendfile.rb:113:incall'
sentry-raven (0.15.2) lib/raven/integrations/rack.rb:54:in call' railties (4.2.0) lib/rails/engine.rb:518:incall'
railties (4.2.0) lib/rails/application.rb:164:in call' rack (1.6.4) lib/rack/lock.rb:17:incall'
rack (1.6.4) lib/rack/content_length.rb:15:in call' rack (1.6.4) lib/rack/handler/webrick.rb:88:inservice'

How can I solve this problem temporarily before some developers fix it?

bug?

Most helpful comment

Can someone please start by writing and PRing a spec for this? And do try to fix it. If you get stuck we'll help out.

All 4 comments

Did this work before? I'd write a spec for it to start.

I upgraded from 0.15.0 to 0.16.2 and it didn't work anymore. Yes. It had worked quite well on 0.15.0.
I'm not sure but I think "#1276: Replace rack-mount with new router " caused the problem.

me too, version array does not work on 0.16.2

Can someone please start by writing and PRing a spec for this? And do try to fix it. If you get stuck we'll help out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmmcgee picture dmmcgee  路  6Comments

Legogris picture Legogris  路  6Comments

nab0310 picture nab0310  路  4Comments

dblock picture dblock  路  7Comments

mcfoton picture mcfoton  路  6Comments