-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Support setting accepted media-type on Preload & Fields pushes #46
Comments
Hi @andrerom, Interesting topic! First, let me explain the current rationale regarding content negotiation:
It means that content negotiation is possible, and actually works, but with one assumed constraint: the In most cases, using the priority mechanism of the So my first question is: isn't the current capabilities good enough? They are just what HTTP allows. So about your proposal:
What we can do however, is to add a new escape character in the extended JSON Pointer format as we've done for Finally, is there any example in the RFC corpus of marking a key with a MIME type like you propose? If yes, we should use the same character than the existing one (RFC tries to be consistent altogether). If no, maybe that we shouldn't add this in the main spec (The Vulcain spec is designed to be as minimal as possible), but could be provided as an extension (using the escaping trick I suggest just above)? |
I have looked for it, I tried to look for examples on JSON API / Open REST / RFCs, but didn't quite find what I was looking for, so I think no. As for Accept header, for some cases that could work. But it's a global header, and Preload and Fields are essentially loading other documents then the main request, which in our case might have different or conflicting* media types * conflicting as in several of them might be same entity type, root and leaf might be same, but you might want different representation of them due to the data you need. I know this sounds very abstract, so if you want I can try to write a more concrete example on the use case, but TL;DR; both will be "Content" in our case. |
What do you think about an extension (that can be stored in this repo but that will not be proposed to IETF)? |
maybe But I did kind of find a spec that allows this now, however it's not embedded in the URI itself. See Link header spec for
Did not see concrete example in the spec, but seems like it should be something like this (however maybe with more relevant
This is also used for Server Push:
So, would it be feasible to align with subset of Link spec here? Example:
Side: As shown in last example, media types can also be used for versioning the API gracefully over time on a per resource basis. |
This was not really solved in #54 as that is more about doing a media type selector feature, and not so much about content / media type negotiation aspect. But that said, I guess we can rather solve our need by making sure to expose additional links in our responses which can be used by Preload or expanded using Fields. So this can stay closed for now. |
Let’s reopen (it has been automatically closed by GitHub) until we describe a solution for all use cases. |
I choose to view Vulcain as a possible REST maturity models level 4. So I'm wondering if it should be possible to specify accepted media-type on pushes / preloads via Preload and Fields in order to fit well with already mature REST API's that uses media type for content negotiation.
In all transparency we use that in eZ Platform, and it's a rather powerful concept as it allows integrators to extend certain api endpoints. But unlike graphQL where caller can ask for whatever, in this case someone would need to code alternative representations.
While it would have to be in a format that can work both in the header and query format, something like the following might be a way to do it:
Open questions:
/
, here shown encoded using%2F
as possible measure to avoid conflicts with pathFields:
or not if already specified. Here suggested to be optional however no strong opinion on that.:
, however that is legal in URI's so maybe it will have to be something else, did not find any MIME's with this tough;charset=UTF-8
The text was updated successfully, but these errors were encountered: