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 constant RspecApiDocumentation::Writers::JsonWriter (NameError) #382

Closed
rlgreen91 opened this issue Jul 2, 2018 · 13 comments

Comments

@rlgreen91
Copy link

System info:

  • Ruby 2.5.1
  • Rails 5.2.0
  • Rspec 3.7.0
  • RspecApiDocumentation 5.1.0

I have my specs set up in spec/acceptance, as required. When I run bundle exec rake docs:generate, I get the following error:

/Users/rachel/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant': uninitialized constant RspecApiDocumentation::Writers::JsonWriter (NameError)

My configuration is set up as described in rails_helper.rb. This only occurs with trying to output as JSON - outputting as a different format, like HTML, works fine. I'm guessing it's not resolving the names correctly - it's looking for JsonWriter, not JSONWriter, as listed in the gem.

@jakehow
Copy link
Member

jakehow commented Jul 5, 2018

This is related to PR #359

@rprieto
Copy link

rprieto commented Jul 13, 2018

Note: it also affects the :open_api format (since it's JSON based).

@obromios
Copy link

I am seeing this when cloning the repository and change

#example/spec/acceptance_helper.rb
..
config.format = [:open_api]
...

to config.format=[:json]

@jclif
Copy link

jclif commented Aug 29, 2018

Experiencing this issue as well.

@xtofthomas
Copy link

rspec_api_documentation/api_documentation.rb:35:in `const_get': uninitialized constant RspecApiDocumentation::Writers::JsonWriter (NameError)

The same for me too !

@vladimirbazhanov
Copy link

I see the same issue too

@jakehow
Copy link
Member

jakehow commented Aug 31, 2018

I linked to the issue that probably created this above. If you are experiencing this check that out and see if it helps. My guess is there was some change between Ruby/Rails versions that flipped how this constant was interpreted and we will need to handle it with a check or alias the constant.

If someone experiencing this can put up a sample app with the problem and pinned to the versions they are experiencing it with via a .ruby-version and Gemfile.lock maybe we can narrow it down.

@bf4
Copy link
Contributor

bf4 commented Sep 2, 2018

solution: change config.format = :json to config.format = :JSON.

@roramirez
Copy link

as @bf4 mention before this fix the issue for me.

Here is my Gemfile.lock

@oestrich
Copy link
Contributor

oestrich commented Sep 4, 2018

I merged #399, can everyone update to the git master branch and let me know if it solves your problems? If it does, I'll do a new release on rubygems.

@incubus
Copy link

incubus commented Sep 11, 2018

It works, thanks!

@dikond
Copy link

dikond commented Sep 20, 2018

I can confirm that it works on master.

@oestrich
Copy link
Contributor

oestrich commented Oct 3, 2018

6.1.0 is out and has #399 in it.

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