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

jsonapi.org and custom vendor content type #1141

Closed
igas opened this issue Sep 1, 2015 · 2 comments
Closed

jsonapi.org and custom vendor content type #1141

igas opened this issue Sep 1, 2015 · 2 comments
Labels

Comments

@igas
Copy link

igas commented Sep 1, 2015

Hi. According to spec http://jsonapi.org/format/#content-negotiation Content Negotiation part, I must use application/vnd.api+json.

If I do:

content_type :jsonapi, "application/vnd.api+json"
formatter :jsonapi, -> (object, _env) { Oj.dump(object) }

It return 406 cause try to use json. I found 3409da5 where vendor part drops. Is there any reason to do this?

From my point of view formatter should only format data, but it also overwrite content type but it is here.

Current implementation https://github.com/ruby-grape/grape/blob/master/lib/grape/middleware/formatter.rb#L170 & https://github.com/ruby-grape/grape/blob/master/lib/grape/middleware/formatter.rb#L122

Do I miss something?

@dblock
Copy link
Member

dblock commented Sep 1, 2015

You need to tell Grape which format to use, so format :jsonapi I think will do it?

@dblock dblock added the discuss! label Sep 1, 2015
@dblock
Copy link
Member

dblock commented Sep 1, 2015

Bring it up to the mailing list if you're still having problems, I'll close this here.

@dblock dblock closed this as completed Sep 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants