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

Change Json classnames to JSON #359

Merged
merged 15 commits into from
Apr 14, 2018
Merged

Change Json classnames to JSON #359

merged 15 commits into from
Apr 14, 2018

Conversation

llenodo
Copy link
Contributor

@llenodo llenodo commented Oct 4, 2017

When running the docs:generate command I was getting the following error:

/rspec_api_documentation-5.1.0/lib/rspec_api_documentation/api_documentation.rb:33:in `const_get': uninitialized constant RspecApiDocumentation::Writers::JSONWriter (NameError)

Turned out to be this line in RspecApiDocumentation::ApiDocumentation:

RspecApiDocumentation::Writers.const_get("#{format}_writer".classify)

apparently "json_writer".classify is now returning JSONWriter instead of JsonWriter, thus giving the uninitialized constant error

@oestrich
Copy link
Contributor

oestrich commented Oct 5, 2017

Hi @llenodo thanks for the PR, can you get CI passing and I'll be happy to merge these in. Looks like it just needs the specs to have the updated names.

Do you know if this is a change with a later activesupport? Trying to decide if we should restrict on anything with this change since older versions of something will still try the lowercase version.

@llenodo
Copy link
Contributor Author

llenodo commented Oct 5, 2017

Tests are passing now, ran into some issues with JsonIodocsWriter so changed the name back. Could be due to different version of activesupport in the code here vs my project (rails 5.1)

@oestrich oestrich merged commit 97c129d into zipmark:master Apr 14, 2018
@oestrich
Copy link
Contributor

Thanks!

@jandudulski
Copy link

For me json_writer.classify returns JsonWriter - tested both on Rails 5.1 and 5.2. When tried to use rspec_api_documentation from master now I have an error uninitialized constant RspecApiDocumentation::Writers::JsonWriter.

I think this PR should be reverted and problem investigated with more details.

@bf4
Copy link
Contributor

bf4 commented Sep 3, 2018

I wonder if there was an active support inflection set up in OP's setup. In any case, rather than classifying, you probably want to register the formatter names like I did in AMS https://github.com/rails-api/active_model_serializers/blob/f3a19bd515330751083c0a70b8f57d792de0d788/lib/active_model_serializers/adapter.rb

@ConorSheehan1
Copy link

The examples in the readme are broken now.
You have to use all caps for json config.format = :JSON
as @bf4 mentions here #382 (comment).

I'd prefer if all the formats were the same case, or case insensitive.
Is that coming in the next release?

ConorSheehan1 added a commit to ConorSheehan1/rspec_api_documentation that referenced this pull request Sep 13, 2018
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

Successfully merging this pull request may close these issues.

5 participants