feat: improve PageResource hypermedia linking
Regaez opened this issue · 1 comments
Regaez commented
The children
property should be moved out of the PageResource attributes
and added to the links
hypermedia.
For example:
"links": {
"self": "http://localhost:8080/parent-page",
"children": [
"http://localhost:8080/parent-page/child-1",
"http://localhost:8080/parent-page/child-2"
],
"related": {
"self": "http://localhost:8080/api/pages/parent-page",
"children": [
"http://localhost:8080/api/pages/parent-page/child-1",
"http://localhost:8080/api/pages/parent-page/child-2"
],
"resource": "http://localhost:8080/api/pages/"
}
}
Similarly, a child
page should have a parent
link:
"links": {
"self": "http://localhost:8080/parent-page/child-1",
"parent": "http://localhost:8080/parent-page",
"related": {
"self": "http://localhost:8080/api/pages/parent-page/child-1",
"parent": "http://localhost:8080/api/pages/parent-page",
"resource": "http://localhost:8080/api/pages/"
}
}
Similarly, a child
page should have a siblings
field for pages at the same level:
"links": {
"self": "http://localhost:8080/parent-page/child-1",
"parent": "http://localhost:8080/parent-page",
"siblings": [
"http://localhost:8080/parent-page/child-2"
],
"related": {
"self": "http://localhost:8080/api/pages/parent-page/child-1",
"parent": "http://localhost:8080/api/pages/parent-page",
"siblings": [
"http://localhost:8080/api/pages/parent-page/child-2"
],
"resource": "http://localhost:8080/api/pages/"
}
}
Regaez commented
Perhaps related
should be renamed to api
(since it's currently only API links)? 🤔