Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized class variable @@hide_format #60

Closed
Jokery opened this issue Sep 10, 2013 · 8 comments
Closed

uninitialized class variable @@hide_format #60

Jokery opened this issue Sep 10, 2013 · 8 comments

Comments

@Jokery
Copy link

Jokery commented Sep 10, 2013

NameError (uninitialized class variable @@hide_format in #Class:0x00000006debf88):
grape-swagger (0.6.0) lib/grape-swagger.rb:68:in `block (2 levels) in setup'

i'm using mruby 1.9.2-p290, i dont know whether this will work on higher version, but simply i dont think initialize a class variable in Class.new(Grape::API) can be reached in helpers do(which means Module.new)

@dblock
Copy link
Member

dblock commented Jul 14, 2014

This is old, I am going to close this. @Jokery did you ever resolve this? Please reopen if this is still an issue on newer versions of the gems.

@dblock dblock closed this as completed Jul 14, 2014
@kittrCZ
Copy link

kittrCZ commented Dec 9, 2014

I can see again this issue. I get:

uninitialized class variable @@hide_format in #<Module:0x007fa683697658>

Gemfile & Gemfile.lock

gem 'grape', github: 'intridea/grape'
gem 'grape-rails-routes'
gem 'grape-swagger'
gem 'grape-swagger-rails'
gem 'rack-cors', :require => 'rack/cors'
    grape-swagger (0.7.2)
      grape (>= 0.2.0)
      grape-entity (>= 0.3.0)
      kramdown (>= 1.3.1)
    grape-swagger-rails (0.0.10)
      grape-swagger (~> 0.7.2)
      railties (>= 3.2.12)

Implementation

File: controllers/api/v1/base.rb

require 'grape-swagger'

module API
  module V1
    class Base < Grape::API
      mount API::V1::Users

      add_swagger_documentation base_path: "/api",
                                api_version: 'v1',
                                hide_documentation_path: false

    end
  end
end

Logs

NameError (uninitialized class variable @@hide_format in #<Module:0x007fa683697658>):
  grape-swagger (0.7.2) lib/grape-swagger.rb:269:in `parse_path'
  grape-swagger (0.7.2) lib/grape-swagger.rb:96:in `block (2 levels) in setup'
  grape-swagger (0.7.2) lib/grape-swagger.rb:93:in `map'
  grape-swagger (0.7.2) lib/grape-swagger.rb:93:in `block in setup'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:47:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:47:in `block in generate_api_method'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:248:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:248:in `run'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:196:in `block in call!'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/base.rb:24:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/base.rb:24:in `call!'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/base.rb:18:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/error.rb:27:in `block in call!'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/error.rb:26:in `catch'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/error.rb:26:in `call!'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/middleware/base.rb:18:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  rack (1.5.2) lib/rack/builder.rb:138:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:197:in `call!'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/endpoint.rb:185:in `call'
  rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call'
  rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize'
  rack-mount (0.8.3) lib/rack/mount/code_generation.rb:68:in `optimized_each'
  rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'
  rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/api.rb:104:in `call'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/api.rb:33:in `call!'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bundler/gems/grape-3d4db18ed187/lib/grape/api.rb:29:in `call'
  actionpack (4.1.8) lib/action_dispatch/journey/router.rb:73:in `block in call'
  actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:678:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/flash.rb:254:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.1.8) lib/active_support/callbacks.rb:82:in `run_callbacks'
  actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.8) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.8) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.8) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.8) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.1.8) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  rack-cors (0.2.9) lib/rack/cors.rb:54:in `call'
  railties (4.1.8) lib/rails/engine.rb:514:in `call'
  railties (4.1.8) lib/rails/application.rb:144:in `call'
  unicorn (4.8.3) lib/unicorn/http_server.rb:576:in `process_client'
  unicorn (4.8.3) lib/unicorn/http_server.rb:670:in `worker_loop'
  unicorn (4.8.3) lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
  unicorn (4.8.3) lib/unicorn/http_server.rb:140:in `start'
  unicorn (4.8.3) bin/unicorn:126:in `<top (required)>'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bin/unicorn:23:in `load'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bin/unicorn:23:in `<main>'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bin/ruby_executable_hooks:15:in `eval'
  /Users/tomashertus/.rvm/gems/ruby-2.1.5@challe/bin/ruby_executable_hooks:15:in `<main>'

@dblock
Copy link
Member

dblock commented Dec 9, 2014

This has been fixed on HEAD, gem 'grape-swagger', github: 'tim-vandecasteele/grape-swagger', will be released when Grape is released.

@kittrCZ
Copy link

kittrCZ commented Dec 9, 2014

Do you know when new Grape is released?

@dblock
Copy link
Member

dblock commented Dec 9, 2014

There're still some blockers, so no.

@tian-xiaobo
Copy link

I can see again this issue. I get:


Started GET "/api/v1/swagger_doc" for 127.0.0.1 at 2015-01-21 10:54:58 +0800

NameError (uninitialized class variable @@hide_format in #<Module:0x007ff377514240>):
  /use/36kr/bundle/ruby/2.2.0/gems/grape-swagger-0.7.2/lib/grape-swagger.rb:269:in `parse_path'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-swagger-0.7.2/lib/grape-swagger.rb:90:in `block (2 levels) in setup'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-swagger-0.7.2/lib/grape-swagger.rb:90:in `reject!'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-swagger-0.7.2/lib/grape-swagger.rb:90:in `block in setup'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/endpoint.rb:47:in `call'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/endpoint.rb:47:in `block in generate_api_method'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/endpoint.rb:247:in `call'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/endpoint.rb:247:in `run'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/endpoint.rb:195:in `block in call!'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/base.rb:24:in `call'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/base.rb:24:in `call!'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/base.rb:18:in `call'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/base.rb:24:in `call!'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/base.rb:18:in `call'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/error.rb:27:in `block in call!'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/error.rb:26:in `catch'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/error.rb:26:in `call!'
  /use/36kr/bundle/ruby/2.2.0/gems/grape-0.10.1/lib/grape/middleware/base.rb:18:in `call'

@tian-xiaobo
Copy link

@dblock what fixed on HEAD where code?

@dblock
Copy link
Member

dblock commented Jan 21, 2015

@tian-xiaobo You're using grape-swagger 0.7.2, which doesn't support grape 0.10.1, upgrade to the latest, 0.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants