-
Notifications
You must be signed in to change notification settings - Fork 38
Description
As we've found in trying to resolve #386, the specification is presently unclear on what key one should use for the various JSON:API relationships one include in the relationship dictionary as part of a JSON:API-formatted response.
Given that we do not say anything about it, one may be led to believe that any key is permissible. However, the output-format-agnostic description of relationships in 3.6 Relationships makes no reference to a free-form "key" or "name" tied to an OPTIMADE relationship, so this is then some data that would only appear in a JSON:API response.
From the discussion in #386 it seems we have (at least) two options:
-
Mandate that the key must be the entry type (e.g., "structures"), and thus that there is no contextual "grouping" of related entries, but rather, all related entries of the same type are grouped, and cannot be grouped with entries of a different type. This can be done by: Edit 5.3.2 Entry Listing JSON Response Schema and for the definition of the "relationships" field say that: "Relationships MUST be grouped into a single JSON API relationships object for each entry type and placed in the relationships dictionary with that entry type name as key (e.g., "structures").
-
Preserve the possibility of a free-form JSON:API relationship key that can "group" related entries (possibly of different types) under a name. This can be done by describing the feature of a 'relationship name' to 3.6 Relationships. Preferably with some hint in the implementers note about how one can encode these names in more straightforward key-value based output formats (e.g. "type name + '_' + relationship name"?). It is probably also a good idea with a clarification in 5.3.2 that the key in this dictionary field represents this "relationship name".
We probably need to sort this out before merging #386.