Closed pke closed 7 years ago
I guess the same reasoning applies as for multiple classes for the HTML class
attribute: In order to have multiple ways for referring to the same element from different contexts.
For example, one might assign a generic relation item
and a domain-specific relation order
to each element of an order collection.
In general, using an array instead of a single value is more open for extensions of the spec in the future.
I guess the rationale for using an array is a combination of the above two reasons. However, I am just guessing here :)
@pke Yes, there can be more than one link relation on links and sub-entities.
Take this example:
{
"class": [
"root"
],
"links": [
{
"rel": [
"self"
],
"href": "http://stage.zettaapi.org/"
},
{
"title": "cloud",
"rel": [
"http://rels.zettajs.io/server"
],
"href": "http://stage.zettaapi.org/servers/cloud"
},
{
"rel": [
"http://rels.zettajs.io/events"
],
"href": "ws://stage.zettaapi.org/events"
},
{
"title": "annarbor",
"rel": [
"http://rels.zettajs.io/peer",
"http://rels.zettajs.io/server"
],
"href": "http://stage.zettaapi.org/servers/annarbor"
},
{
"title": "detroit",
"rel": [
"http://rels.zettajs.io/peer",
"http://rels.zettajs.io/server"
],
"href": "http://stage.zettaapi.org/servers/detroit"
},
{
"rel": [
"http://rels.zettajs.io/peer-management"
],
"href": "http://stage.zettaapi.org/peer-management"
}
],
"actions": [
{
"name": "query-devices",
"method": "GET",
"href": "http://stage.zettaapi.org/",
"type": "application/x-www-form-urlencoded",
"fields": [
{
"name": "server",
"type": "text"
},
{
"name": "ql",
"type": "text"
}
]
}
]
}
You can see that there are links to server
s, some of which are classified as peer
s. It allows modeling of complex relationships.
We have client code that searches for an executes only on server
links. And we have another branch of client code that operates only on peer
s.
Thanks to all for the explanation
Can there be more than one rel on a link/action?