-
Notifications
You must be signed in to change notification settings - Fork 890
Associate "relationship object" with everything else #946
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
Conversation
object"). Members of the relationships object ("relationships") represent | ||
references from the [resource object][resource objects] in which it's defined to other resource | ||
objects. | ||
object"). Members of the relationships object represent "relationships", i.e., |
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.
While we're here:
...references from the resource objects in which they are defined...
Also, this needs to be updated here too:
https://github.com/json-api/json-api/blob/gh-pages/_format/1.1/index.md
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.
I wondered about that too. The "it" refers to the relationships object, which is singular. But yes, I agree that it would sound more correct if we referred to the relationships themselves.
👍 from me with those minor nits |
Looks like the author of these rules in
This is my first time dealing with the normative statements file. May an existing |
d6b8bf1
to
b45098d
Compare
You can edit the id strings if you like--to my knowledge nobody is using them (yet) :(. Ideally, we'd mark up our format.md files such that we can generate the normative statement files, but we haven't done so yet. This is to assist with automated testing for the specification. If you have the bandwidth to make this happen, that would be amazing. |
Commit updated. I ended up leaving the |
|
||
Relationships may be to-one or to-many. | ||
|
||
A "relationship object" **MUST** contain at least one of the following: | ||
Each relationship **MUST** be represented by an object (a "relationship object") |
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.
So, if we're being nitpicky/precise, my mental model has always been that each relationship has two parts: its name and its contents (the linkage, not the related). So maybe we should say "Each relationship's contents....", or use the prior wording, or make the name + contents division more explicit?
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.
Yeah, "each relationship's contents" would seem to make sense.
The prior wording didn't associate relationship objects with any of the other definitions, which prompted the patch in the first place.
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.
One potential problem with "each relationship's contents" is that the relationship object also includes links, and I'm not sure if those are part of the contents???
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.
One way to sidestep the entire issue is to specify that each member of a relationships object must be a relationship object.
It's already mentioned that members of a relationships object represent relationships, so a relationship object's purpose could be defined in terms of either.
b45098d
to
a243917
Compare
@ethanresnick: Looking at this again, I don't think "contents" is a necessary addition, particularly if you feel it's not well defined what makes up the contents. By necessity, objects consist of key-value pairs, so if a key-value pair represents a relationship, then saying that "a relationship must be represented by an object" makes it very clear that we're referring to the value. In the Links section there's an exactly similar case:
As for a relationship's contents, there's one existing mention:
It does suggest that the content might refer to the set of the referenced resources, although it would be fairly easy (and probably a good idea) to come up with a dedicated term for this, such as a "relationship's target". |
a243917
to
b45098d
Compare
Just checking in here... is the current round of bike-shedding complete? Are we ready to re-review? |
I'm not sure. The question raised by @ethanresnick was whether it's okay to say
when we actually mean
I'm curious as to what others think. To be sure, the latter is more accurate but perhaps a bit awkward. Another angle is to figure out a term for the value part of a relationship and say
|
First off, I agree that this PR as written is better than the current text, and it may be good enough. If we want to be totally accurate, though, I think there's a way to separate the definitions of the relationship's name, contents (which isn't a term we need to use necessarily), and "relationship object" without being too awkward. Here's probably what I'd say (key changes in bold):
Thoughts? |
But isn't this accurate only for to-many relationships? A to-one relationship doesn't feel like a "set of references".
+1. I think this alone is enough to supplant the "named set" addition.
Saying that the object "contains the set of referenced resources" sounds wrong to me; it only contains the references, not the resources. Or is this in preparation for embedded resource objects? Since the entire bolded segment is basically a summary of what is normatively stated right in the subsequent paragraph, I'd just drop that part entirely:
|
In my mind, it applies for to-one relationships too (since a set can be limited to one item, which is what I think the next paragraph does), but I see how it could be confusing, so I'm fine with changing it. Ideas?
Ok, but would that mean going back to "[relationships are] references from the resource object in which they are defined to other resource objects". If so, that just sounds a bit weird to me... in my head it's the resource identifier object that's the reference, not the relationship, which is why I'd said the relationship is a set of references.
Good catch. If we were going to keep it, it should say something like "contains the references that constitute the relationship".
Works for me. (Though aren't we just back to your original complaint, then, that the definition of a "relationship object" isn't really connected conceptually to what comes before?) |
I love how deep this rabbit hole is going 😄
Aha, this explains a lot. I never considered "reference" with this kind of static meaning in mind. Thus, I've thought it's perfectly okay to simultaneously say that
where the first statement implies nothing about the concrete representation or the cardinality of the target. If we want to narrow the usage of "reference", the first paragraph could say:
In fact, "enclosing" might be preferable to "in which they are defined" regardless of the decision w.r.t. "reference".
No. In the published spec, the definition of relationship object just appears out of nowhere. In the current iteration, we have the statement:
This bridges the gap and is associated with the concept of relationships via the first paragraph that defines relationships object members as relationships. |
Indeed. At least we seem to be getting somewhere 😄 I'll take a look at this with fresh eyes tomorrow. |
Ok, so it sounds like the text you're proposing is:
(Or the above, but replacing "Each member..." with "Members...".) If that's right, then I'm fine with it! Update the PR and we'll get it merged :) |
Thanks a lot for working on this one. I reviewed it looking at latest state of v1.1. I think that clarification is still needed. I created a follow-up merge request at #1608 to finally get it in. I hope that's okay with everyone who had worked on this before. If you have time, I would appreciate a review of that one to ensure that I understood the consensus reached here correctly. |
Formally connects relationship objects to relationships and, by extension, to relationships objects.
The current language effectively doesn't specify what can go inside relationships objects.
Also, clearly stating the parity between "each relationship" and "an object" hopefully helps emphasize the fact that the section is discussing two different concepts. The distinction between relationships objects and relationship objects is too easy to overlook at first.
Edits the sentence that defines members of a relationships object as "relationships". Rather, the members only represent relationships.
Fixes a broken link nearby.