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

Set default format to be .json. #245

Closed
wants to merge 1 commit into from

Conversation

sunnyrjuneja
Copy link
Contributor

Fixes:
https://github.com/tim-vandecasteele/grape-swagger/issues/244
ruby-grape/grape-swagger-rails#11

Perhaps more. Not sure if we need any specs for this.

@dblock
Copy link
Member

dblock commented Apr 9, 2015

I definitely think we should have specs, some behavior has changed, right?

@dblock
Copy link
Member

dblock commented Apr 9, 2015

It also needs a CHANGELOG and an UPGRADING entry.

@dmitry
Copy link
Contributor

dmitry commented Apr 28, 2015

Since that change is it possible to access to the resources with the .json extension postfix?

@dmitry
Copy link
Contributor

dmitry commented May 18, 2015

@whatasunnyday can you please update changelog and upgrading files?

@sunnyrjuneja
Copy link
Contributor Author

@dmitry Sure.

@dmitry
Copy link
Contributor

dmitry commented May 20, 2015

@whatasunnyday 👍
@dblock I believe everything is ready to be merged now.

@@ -1,6 +1,17 @@
Upgrading Grape-swagger
=======================

### Upgrading to >= 0.10.2

Previously, grape-swagger hide the format in the URL by default. This conflicted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hide => hid

@dblock
Copy link
Member

dblock commented May 20, 2015

I still think this needs a test! We're changing behavior, what prevents a future committer to revert it?

@sunnyrjuneja
Copy link
Contributor Author

I actually agree 100% but I'm quite confused the current state of the tests. The tests fail for grape 0.10.0 to 0.11.0 but pass on HEAD. Why is this?

I was thinking to change https://github.com/tim-vandecasteele/grape-swagger/blob/master/spec/default_api_spec.rb, specifically:

    subject do
      get '/swagger_doc'
      JSON.parse(last_response.body)
    end

to

    subject do
      get '/swagger_doc.json'
      JSON.parse(last_response.body)
    end

but the tests pass even though I changed format: :json. I do not understand if the tests are testing anything at all!

@sunnyrjuneja
Copy link
Contributor Author

Also, the tests here should be folded into default_api_spec.rb.

https://github.com/tim-vandecasteele/grape-swagger/blob/master/spec/non_default_api_spec.rb#L583-L612

Update:

I've removed areas in the tests that specify format: :json. I moved the test that checked if format: :json worked correctly into the default api spec. Is this the right idea? Should I change where the tests call for /swagger_doc to /swagger_doc.json and /swagger_doc/resource to /swagger_doc/resource.json? Will this solve the failing tests? Would like guidance before moving forward.

@dblock
Copy link
Member

dblock commented May 21, 2015

Right, we are likely missing tests around this, this is a good time to add them.

With your change Grape 0.10.0, 0.11.0, etc. are broken by default. So we can't ship this, it looks like it's as simple as requesting with .json vs. without .json, but I am not 100% sure what to do about it. Either way we want this PR not to break any tests ;)

@LeFnord
Copy link
Member

LeFnord commented Oct 26, 2016

please re-target against swagger-1.2 branch or close

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

Successfully merging this pull request may close these issues.

4 participants