Closed frans-beech-it closed 6 years ago
Hi @frans-beech-it, I added again @Autoregister
decorator. With decorator, service.register();
is not required, but still necesary inject service.
Any ideas for a way to injection of dependency is not necessary? :thinking:
And Additional the data loaded is behaving differently when cache is enabled
Without cache or first time when loaded
With Cache after first time
I think original issue by @frans-beech-it was solved in #71
@sunel, Your example I don't understand very well.... If you open a new issue with the same example data but add and example uri and method? Maybe I understand your example and it's really the same issue.
@pablorsk created #78
Working for me with the workaround @frans-beech-it suggested :clap: .
Waiting for a release including #71 to test Autoregister()
.
Does it work with multi level association?
eg: include: ['author', 'photos', 'photos.comments']
In my case the first relationship (photos
) has an extra relationship (comments
) but it's empty:
{
"content": "none",
"data": {}
}
I'll keep playing as it might come from my code.
Let me know if I should open a new issues or if you have some tips :)
@pablorsk any ideas regarding the above? I tried to reproduce the case with the demo but it looks like the playground doesn't support requesting resources related to other resources, eg:
GET /v2/stores/1?include=books.chapters
Hi @ouranos. I'm finding the same problem with nested relationships. Have you managed to resolved that issue?
@adolf86, JsonApi playground backend dont support include or sorted refereces with .
.
Try with version 1.1.2 if your problem is with library.
@pablorsk updated to v1.1.4
@AutoRegister
now works properly but it doesn't seem to fix the problem for nested relationships ("photo.comments" in my example)
@ouranos Did you find a solution or fix for the problem with nested relationships?
@jonasgrundtvig No, we do manual HTTP calls and parsing for the few endpoints that need it.
Maybe we are just missing something. But we run into the issue that relations loaded thought the
?include=
parameter aren't correctly populated when the service beloning to that service isn't registered manually.If the service belonging to the related object isn't loaded the relation has an
id
but thecontent
variable has the valuenone
.You can also see this behavior in the demo:
We added the following workaround to
app.module.ts
of our project: