News for hackers. Stuff that matters.
Re:REST vs. GraphQL – A search for evidence on which is better by t-writescode on Tuesday December 15, 2020 @01:22PM (#25433169)
Could you define your terms?

Especially:

  * uniform interface
  * hypertext
And even more especially how JSON does not meet the requirements?
Re:REST vs. GraphQL – A search for evidence on which is better by recursivedoubts on Tuesday December 15, 2020 @01:29PM (#25433263)
Uniform interface: https://en.wikipedia.org/wiki/Representational_state_transfe...

Hypertext: https://en.wikipedia.org/wiki/Hypertext

JSON is obviously not a native hypertext, any more than plain text or CSV is. You can, of course, embed URLs in it (or any other format) and call it a hypertext. That's usually pointless, as the links will be consumed by code (rather than a human, in the canonical HTML->browser interaction) so if the URLs aren't simply ignored, they will be dealt with generically.

I wrote about this in HATEOAS is for humans:

https://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.h...

Re:REST vs. GraphQL – A search for evidence on which is better by t-writescode on Tuesday December 15, 2020 @01:51PM (#25433550)
Curious to me is that it seems you argue that XML is a valid hypertext; but, isn't it possible to implement most any valid xml document as a json document, even considering attributes?

And, have you seen Github's API implementation? They have the links and self-referential details in their particular json schemas that you seem to imply are necessary and unique for that.

If the argument is that json can't be rendered, isn't it arguable that xml equally has that problem, we just have a program with a common syntax reader format that renders pages equivalently, and something equivalent could be written for a particular json schema?

Re:REST vs. GraphQL – A search for evidence on which is better by recursivedoubts on Tuesday December 15, 2020 @02:22PM (#25433932)
I do not think that XML is a hypertext. So I agree with you.

HTML is a hypertext.

Yes, Github probably has one of the most as-REST-like-as-possible JSON apis, and it's mostly wasted effort. It would be just as usable, as an API, without all that stuff, since it is consumed by code, not a browser/human.

Re:REST vs. GraphQL – A search for evidence on which is better by t-writescode on Tuesday December 15, 2020 @02:24PM (#25433956)
What does HTML have that XML doesn't have? Isn't XML a superset of HTML?
Re:REST vs. GraphQL – A search for evidence on which is better by gtramont on Wednesday December 16, 2020 @12:46AM (#25439504)
Maybe the following links can help in understanding hypertext/hypermedia?

http://amundsen.com/hypermedia/hfactor/

https://gtramontina.com/h-factors/

Re:REST vs. GraphQL – A search for evidence on which is better by recursivedoubts on Tuesday December 15, 2020 @02:42PM (#25434150)
It has a hypermedia spec:

https://www.w3.org/TR/html4/

And a bunch of things called "browsers" that implement that spec. More or less.

I mean, come to that, aren't XML and HTML both just text? Isn't text, then, a hypertext? One can embed URLs in text, after all...

Re:REST vs. GraphQL – A search for evidence on which is better by t-writescode on Tuesday December 15, 2020 @02:54PM (#25434312)
Does this mean that your argument that json can't be a hypertext is because it doesn't already have a universal hypermedia spec?
Re:REST vs. GraphQL – A search for evidence on which is better by recursivedoubts on Tuesday December 15, 2020 @03:52PM (#25435095)
The language here is getting a little squirrly. "Can't be a hypertext" is too restrictive. "Isn't a hypertext" is how I would say it.

JSON as JSON isn't a hypertext in the same way that XML as XML isn't a hypertext. XHTML is a hypertext based on XML. (HTML itself isn't proper XML.)

There are hypertext specs based on JSON, such as: https://json-schema.org/draft-04/json-schema-hypermedia.html

But, without clients that treat the data as a uniform interface, it's all mostly pointless, which is why most JSON APIs stop at Level 2 of the Richardson Maturity Model, and why things like GraphQL are becoming more and more popular.

In the original model of the web (which is what Fielding was describing w/ REST) where HTML was being delivered to a browser, the uniform interface works: a browser has no idea what the HTML document means but can render it to a form that the human looking at it can make sense of.

Re:REST vs. GraphQL – A search for evidence on which is better by t-writescode on Tuesday December 15, 2020 @10:07PM (#25438584)
Thank you for clarifying your stance