[MGNLREST-200] Delivery endpoint returns arrays of nodes Created: 01/Apr/19 Updated: 10/Feb/20 Resolved: 13/Nov/19 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Story | Priority: | Major |
| Reporter: | Christopher Zimmermann | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Release notes required: |
Yes
|
||||||||
| Documentation update required: |
Yes
|
||||||||
| Date of First Response: | |||||||||
| Story Points: | 8 | ||||||||
| Description |
|
User story:
Notes: Currently the delivery endpoint returns subnodes directly as properties on the parent node, and then a '@nodes' array which includes the names of all of those properties. While this can have advantages when a developer is trying to access a specific node, (because they can just get it by its name) it makes the usecase of accessing lists of subnodes (such as areas, pages, blocks) harder because it adds a level of indirection. Practically in a React or Angular app this can be awkward. So much so that developers have asked us how to iterate over the nodes. Acceptance criteria:
Suggestion: Add the ability to define which nodetypes should be returned in arrays. Any node that is not in one of the specified types is still returned as a direct subnode. So if I specify:
Then the content will include a 'pages' and 'areas' arrays, which includes the subnodes contents. And any subnode NOT included in those arrays will still be included directly on the parent object, and still be listed in the @nodes array. |
| Comments |
| Comment by Mikaël Geljić [ 13/Aug/19 ] |
|
most likely calls for a v3 of the delivery endpoint, open question is if this format should replace the previous one, or if this should be configured on the definition (with array format as the new default) |
| Comment by Christopher Zimmermann [ 09/Sep/19 ] |
|
I can't think of a good default way to do this without specifying the nodeType of the nodes to put into an array. This is because Magnolia content puts different kinds of nodes all at the same level in the heirarchy, for example, mixing blocks from a story with nodes from its outline. For that reason, I would use my suggestion in the ticket description. Developer must explicitly configure the arrays that they would want, otherwise it would continue to work as is. IF we went this route then we could keep it in "v2" endpoint - at least from an "API compatibility" perspective. |
| Comment by Christopher Zimmermann [ 13/Nov/19 ] |
|
Closing as duplicate of https://jira.magnolia-cms.com/browse/MGNLREST-161 |