Deep related resouces with one to many are missing id
barthje opened this issue · comments
The problem is caused by the following:
During normalization (normalizeResource) the related resources are temporarily stored in the data property in the JSON:API format, not as an actual resource.
In the process of normalization each resource is reset to a single state (relationshipApplyToData) via Resource.fromState and resource.state). In this step the JSON:API formatted relation is lost due to it not beeing in Hyral format.
Possible solutions:
- Store related resource as a Hyral Resource instead of the JSON:API format
- Store related resources somewhere else.
The first is the best option I think.
This would need changes to:
- getResourcesFromData
- Maybe relationshipApplyToData or relationshipGetResource but they just might work. Refactor of variable names would be good.