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

How does "formats" work? #192

Closed
dret opened this issue Jun 22, 2016 · 23 comments
Closed

How does "formats" work? #192

dret opened this issue Jun 22, 2016 · 23 comments

Comments

@dret
Copy link
Contributor

dret commented Jun 22, 2016

reading through https://tools.ietf.org/html/draft-nottingham-json-home-04 and looking at the example i cannot quite figure out how "formats" (https://tools.ietf.org/html/draft-nottingham-json-home-04#section-4.2) works.

  • the section talks about GET and PUT, but those aren't the only methods for which it might be necessary to talk about "formats", right?
  • how does the key/value structure work? the example has one key with an empty value, and the section defining "formats" links to a section marked "tbd".

i am working on getting an updated version of the XML syntax ready, and thus i am going through the syntax. however, this seems to be a general issue where it's hard to figure out how that specific feature is supposed to work.

@dret
Copy link
Contributor Author

dret commented Jun 22, 2016

dret/I-D@68ee110 is my first stab at how to do this for the XML syntax. but i am sure this will need to be tweaked once i better understand the "formats" mechanism.

@dret
Copy link
Contributor Author

dret commented Jun 22, 2016

thinking about this some more: maybe this is a combined "GET"/"PUT" hint that's kind of analogous to the "accept-*" ones? if so, for consistency what about having an "accept-put" and leave "formats" to only talk about the formats for retrieval?

@dret
Copy link
Contributor Author

dret commented Jun 22, 2016

now i realize that this is how -02 worked and accept-put then disappeared in -03. to me that seems like a loss, but i am sure there was some reason to do it.

@dret
Copy link
Contributor Author

dret commented Jun 22, 2016

i realize that this structure (using the example from the draft) is not good for the fine-grained "hints" concept. but it associates things more directly and maybe is easier to read and understand?

{"hints": {"allow": [
  {"GET": ["application/json"]},
  {"PUT": ["application/json"]},
  {"DELETE": []},
  {"PATCH": ["application/json-patch"]}
]}}

@mnot
Copy link
Owner

mnot commented Jun 22, 2016

Good Q, although the phrasing reminds me of this :)

Will need to dig into it, not sure I can get to it soon, as I'm on the road for a while.

@dret
Copy link
Contributor Author

dret commented Jun 23, 2016

On 2016-06-22 23:18, Mark Nottingham wrote:

Good Q, although the phrasing reminds me of this
https://www.youtube.com/watch?v=OvmvxAcT_Yc :)

no intention to be offensive on my side, sorry if it came across like
this. simply trying to figure it out as the XML format needs to be aligned.

Will need to dig into it, not sure I can get to it soon, as I'm on the
road for a while.

ok. i'd be more than happy to help, and maybe simplifying the whole
thing (as suggested in #193) to be more about interconnecting resources
and not so much about capabilities would make it easier to move forward.

@mnot
Copy link
Owner

mnot commented Jun 23, 2016

no intention to be offensive on my side, sorry if it came across like
this. simply trying to figure it out as the XML format needs to be aligned.

Oh, no, sorry! Was not trying to imply that, just being silly. Sorry.

@mnot mnot added the json-home label Jul 8, 2016
@mnot
Copy link
Owner

mnot commented Nov 23, 2016

I think it boils down to whether the formats you can GET and PUT are always the same (provided you're allowed to perform both methods, of course).

I can imagine that an API only wants to consume data in one format, but can provide it in more than one.

acceptPut, perhaps?

@mnot
Copy link
Owner

mnot commented Nov 23, 2016

BTW, I'm thinking about ditching representation hints altogether; I think all of the semantics necessary for a home doc can be communicated in the media type / link relation + target attributes. Thoughts?

@asbjornu
Copy link

I think the less JSON Home tries to do, the better. It can very quickly end up duplicating the efforts of Web API specification languages such as Swagger, RAML, API Blueprint, Hydra, etc. As far as I understand, that's not the intention of JSON Home. The only thing I'd ensure is that these specification formats can easily be referenced from the JSON Home document.

mnot added a commit that referenced this issue Nov 24, 2016
@dret
Copy link
Contributor Author

dret commented Nov 24, 2016 via email

@asbjornu
Copy link

@dret: True, thanks for the pointer!

@dret
Copy link
Contributor Author

dret commented Nov 29, 2016 via email

@handrews
Copy link

@mnot does "ditching representation hints" just refer to "formats" or to the whole hints section?

@dret
Copy link
Contributor Author

dret commented Dec 29, 2016 via email

@handrews
Copy link

@dret my question was more on what qualifies as a "representation" hint vs (possibly) other types of resource hints. Like is the "allow" hint a representation hint? It doesn't technically say anything about the representation itself.

@dret
Copy link
Contributor Author

dret commented Dec 29, 2016 via email

@handrews
Copy link

but anyway, exegesis does not make a lot of sense here, let's see what
@mnot says.

Agreed. My interest is that many of the hints complement what JSON Hyper-Schema does, and I'm trying to figure out if it makes sense to use JSON Hyper-Schema and JSON Home together. It would also help me decide whether to push for HTTP-related hints in JSON Hyper-Schema or not. It's been proposed, but honestly if JSON Home can address those in a way that complements JSON Hyper-Schema, I'd rather leave HTTP-specific things out of Hyper-Schema (not that I'm making that decision on my own, but I can push for or against it :-)

@dret
Copy link
Contributor Author

dret commented Dec 30, 2016 via email

@handrews
Copy link

going off-topic: the whole hyper-schema part is a pretty big burden on
the spec already.

It technically is a separate spec, we've just been updating their drafts at the same time. But they don't have to reach RFC at the same time. I don't want to derail this discussion further so if I'm missing your point feel free open an issue over on the JSON Schema repo or mailing list.

@mnot mnot closed this as completed in 9f865df Feb 15, 2017
@dret
Copy link
Contributor Author

dret commented Feb 15, 2017

9f865df leaves the general concept more or less unchanged and adds acceptPut as discussed earlier in this issue. i am wondering about the comments made above about unbundling the home format and the general idea of link descriptions/hints. aren't these two orthogonal concepts that can be combined, but also both make sense as standalone specifications?

@mnot
Copy link
Owner

mnot commented Feb 22, 2017

Well, it changes formats to cover GET (and by extension, HEAD), not PUT.

Which comments were about unbundling the home format? I read them as a side conversation about JSON Hyper Schema.

@mnot mnot mentioned this issue Feb 24, 2017
@dret
Copy link
Contributor Author

dret commented Mar 14, 2017 via email

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

No branches or pull requests

4 participants