Giter VIP home page Giter VIP logo

Comments (8)

dblock avatar dblock commented on May 20, 2024

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.

from grape-swagger.

kittrCZ avatar kittrCZ commented on May 20, 2024

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>'

from grape-swagger.

dblock avatar dblock commented on May 20, 2024

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

from grape-swagger.

kittrCZ avatar kittrCZ commented on May 20, 2024

Do you know when new Grape is released?

from grape-swagger.

dblock avatar dblock commented on May 20, 2024

There're still some blockers, so no.

from grape-swagger.

tian-xiaobo avatar tian-xiaobo commented on May 20, 2024

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'

from grape-swagger.

tian-xiaobo avatar tian-xiaobo commented on May 20, 2024

@dblock what fixed on HEAD where code?

from grape-swagger.

dblock avatar dblock commented on May 20, 2024

@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.

from grape-swagger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.