-
Notifications
You must be signed in to change notification settings - Fork 865
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
Introduce describedby link relation #1447
Conversation
🚢 👍 |
Thanks @dgeb @philsturgeon @gabesullice for initiating this effort. I'd vote for adopting a central default description format to avoid any confusion between API providers and consumers. Any other format can be handled through profiles. In this case, I would prefer OpenAPI because:
PS: We are already using OpenAPI for describing JSON:API resources. This spec is used by both the client and server to handle requests and responses. |
@jugaadi Thanks for your feedback! I agree that OpenAPI is a solid choice and a good starting point. While we don't want to restrict the content type of the description documents pointed to by |
@gabesullice I think this is ready to review. Please let me know what you think about my question from the PR description:
|
@dgeb and I discussed this today. WRT to the question in the description, we decided against allowing I think this PR is ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
There is also this format: https://tools.ietf.org/html/draft-nottingham-link-hint bit different from how this was done, but does the same thing nonetheless |
@evert, afaict, we could integrate that RFC w/ JSON:API fairly easily. They're not mutually exclusive. To do that, we would add If you're saying that we could have added Perhaps you're referring to the
Instead of what we chose:
We considered something like that (i.e. adding a PS. It's funny you mentioned that RFC, I just mentioned it in a post within 30 minutes of your reply 😺 |
Yea just for context, I do believe that your use-case is one of the things link-hints hopes to solve, but it would indeed be a deeper nested structure. I believe the equivalent syntax would actually be:
This makes the most sense for links that are explicitly not self links. For a self link, I would just take the format information and lift it to its own link:
|
Whoaaa, I had not grokked that bit of the RFC. That's a very thought provoking idea... It's interesting how the format is specialized by a schema/profile.
This PR does exactly that, but only for top-level links. |
Probably not worth opening a new issue, but just thought I'd note that The link rel service-desc might be more appropriate for OpenAPI? |
I expect implementors to link to the HTML representations of their OpenAPI spec where they can add a fragment to the URL. For example, https://petstore.swagger.io/#/user |
Hello, all! I am facing an interesting situation (not unlike the previous comment from @gabesullice) that could provide some insight. In our implementation, we want to enhance the experience of developers, mainly because they may have to communicate to similar servers implementing different sets of features (e.g., only some implement a certain filter). So, we have decided to respond to errors with an error object, where we wish to use the link Here are the catches: (i) this is intended to be human-readable; (ii) this usually is not even about resource itself, but the parameters sent in the request. We still want to use |
The
describedby
link relation can be used to identify a description document, which may be an OpenAPI definition, a JSON Schema document, or another description format.It's proposed that the
describedby
member can appear in two places:links
object, in which case it provides a description for the current document.We could optionally allow this member inside any
links
object that can also contain aself
link - namely, resource links and relationship links. This would be consistent with (A) but also somewhat redundant with (B). I'd like to make a decision about this explicitly prior to merging.Another question is whether there should be a central definition of a "description document" within the JSON:API spec, or whether using parenthetical examples
(e.g. OpenAPI or JSON Schema)
is sufficient.related: #1281
/cc @philsturgeon @gabesullice