Make it easier to define link headers #667
Labels
headers
http
Supporting HTTP features and interactions
param serialization
Issues related to parameter and/or header serialization
RFC 5988, section 5 is defining the
Link
HTTP header.It is mainly used on responses to GET requests (but can happen on any kind of response), but can also be used sensible as request headers for PUT, and possibly for the (less common) LINK and UNLINK methods.
It can look like this:
or this (having a list of two links):
(Examples are from the RFC.) As usual with HTTP headers, you could have written this last example also in two headers, like this:
I would like to be able to define that a link with a certain relation type (the value of the
rel
attribute) will/might be available in the response (or must/can be sent in a request). Currently (with OpenAPI 2.0), the best I came up with was this:I guess I could make this an array and use
collectionFormat: csv
, though I'm not sure how either of these would handle the two-headers version.For OpenAPI.next (i.e. 3.0, if possible) I would like some better way of doing this, including to say links of which relation are expected to be there (but not forbidding other ones, of course).
I might be that the "parameters can have schemas" (in #654) with serialization strategies (in #665) might help here, if it gets extended to response headers, too, and we get a special serialization strategy for those kinds of headers.
Any other ideas?
The text was updated successfully, but these errors were encountered: