zuzannast / swagger_ui_engine

Include swagger-ui as rails engine and document your API with simple JSON or YAML files.
https://zuzannast.github.io/swagger_ui_engine/
MIT License
83 stars 43 forks source link

Not supported in rails api only application #12

Closed dhurba87 closed 7 years ago

dhurba87 commented 7 years ago

I get this error when I start my server. My applicaiton is api-only application so it doesn't include any assets files and its middlewares.

/home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0x00000004095f20> (NoMethodError)
Did you mean?  asset_host
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/swagger_ui_engine-1.0.2/lib/swagger_ui_engine/engine.rb:6:in `block in <class:Engine>'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:396:in `instance_exec'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:396:in `block in make_lambda'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:546:in `catch'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:546:in `block in default_terminator'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:170:in `block in halting'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:454:in `block in call'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:454:in `each'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:454:in `call'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:750:in `_run_prepare_callbacks'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:90:in `run_callbacks'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/reloader.rb:87:in `prepare!'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
    from /home/dhurba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
    from /home/dhurba/apps/ror/taskbazaar/config/environment.rb:5:in `<top (required)>'
    from /home/dhurba/apps/ror/taskbazaar/config.ru:3:in `require_relative'
    from /home/dhurba/apps/ror/taskbazaar/config.ru:3:in `block in <main>'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
    from /home/dhurba/apps/ror/taskbazaar/config.ru:in `new'
    from /home/dhurba/apps/ror/taskbazaar/config.ru:in `<main>'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/server.rb:124:in `log_to_stdout'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/server.rb:77:in `start'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in server'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    from /home/dhurba/apps/ror/taskbazaar/bin/rails:9:in `require'
    from /home/dhurba/apps/ror/taskbazaar/bin/rails:9:in `<top (required)>'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
    from /home/dhurba/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
    from /home/dhurba/apps/ror/taskbazaar/bin/spring:15:in `require'
    from /home/dhurba/apps/ror/taskbazaar/bin/spring:15:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'
zuzannast commented 7 years ago

Hello @dhurba87, thanks for reaching out, I'll take a look at this.

zuzannast commented 7 years ago

@dhurba87 if you want to use assets that comes along with swagger_ui_engine, you'll need to add sass-rails to your Gemfile:

gem 'sass-rails'

Should be working corectly after adding this. 🙂

Edit: I'll require this gem in the next #13 version. Thanks!