-
Notifications
You must be signed in to change notification settings - Fork 830
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
Add definition of resource & FAQ entry #376
base: gh-pages
Are you sure you want to change the base?
Conversation
Thanks for this @bintoro. I think this will clear up many misunderstandings. 👍 |
I'm a bit confused by the overloading of the word 'resource'. So we have the HTTP definition of what a 'resource' is. We have the Fielding definition of what a 'resource' is. Are the HTTP definition and the Fielding definitions the same? I assume they are. Then we have the JSON API definition of what a resource is and somewhere I read:
As far as I can see the JSON response documents are representations of resources (both terms in Fielding definition). In my opinion we should not use the word 'resource' in the JSON API spec to mean a different thing. For example:
Could be changed to (remove 'resource' before 'object').
In fact everywhere 'Resource object' could be replaced by just 'object'. Come to think of it 'object' isn't really a good name, because it's just 'data'; there is no behavior... (The objects in JavaScript Object Notation are not really objects actually). In this Pull Request I read:
Why overload the word 'resource' One way to make the difference would be to use the word 'entity'. The second sentence to mention 'resource' in the spec would then read like this
Sections would be renamed like this:
When you use a different word, then every occurence of the word 'resource' in the current spec raises an important question: 'Is this an entity or is this a [HTTP/Fielding] resource'. Am I completely off track here? Or would using a different word clarify the spec? |
I'm curious what the initial motivation for using the word "resource" instead of "entity" was. |
The definition of resource within the JSON API spec is different from the definition in HTTP. This leads to confusion/ambiguity in the spec. By using a different word, be it 'object' or 'entity' we can remove this ambiguity. I chose 'entity' because I think it fits the purpose. A JSON fragment like the following isn't an object (it has no behavior. In fact it's just data.
Maybe there is a better word? |
@kjwierenga, your interpretation is correct. The word "object" is currently used to refer to JSON objects, but "entity" would be workable. I don't want to get too deep into the debate whether the terminology should be changed, as it doesn't bother me that much, but I would certainly support such a change. I don't find the word "resource" particularly important. It could be "entity" or whatever. The success of a standard hinges mostly on its concepts, not the choice of an individual word, and nobody's proposing to change the concept of what is today called "resource". |
Upon scanning the spec for the word 'resource' it actually isn't a big problem because most if not all uses are in fact the JSON API definition of 'resource'. The HTTP definition of 'resource' is avoided by using 'endpoint' instead or by the phrase 'the URL that represents the resource'. Sometimes [JSON API] 'resource' and 'resource object' are used in the same sentence. What is the difference between [JSON API] 'resource' and 'resource object' if any? I guess some problems of definition come up in the 'Responses' section. I think it uses 'resource' in the HTTP definition. I don't think it's a big deal although using a different name would remove all ambiguity. |
A resource object is the JSON representation of a resource (which is a more abstract term). I'm not crazy about the alternative "entity". It doesn't seem to me that an We should at least clarify terminology as @bintoro is attempting with this PR. /cc @steveklabnik @wycats |
@kjwierenga The spec never uses "resource" in the HTTP meaning, or if it does, it's a bug. A resource object is the JSON representation of a resource. |
@bintoro would you be willing to rebase and ping when ready? |
This can be closed? |
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.
@dgeb I think we want to revisit this one. I think this clarification if the term resource used in the spec would help a lot to prevent confusion.
Currently no definition of resource exists in the spec, yet the very first sentence establishes that it is a key concept.
This PR adds a definition for resource in the intro section along with a FAQ entry detailing the difference from an HTTP resource and explaining why this leads to the ID+type requirement. It also felt appropriate to bring some mention of HTTP into the very beginning.
Addresses: #354, #373