getEmbedded() returns empty Array despite the set embedded response
See original GitHub issueFirst of all thank you for the implementation of the ketting library - it works like a dream for most of our endpoints.
However I observed a strange behavior for one of our endpoints. The embedded GET returns an empty array, although the embedded attribute is filled in the API response.
Do you have any suggestion, how it could be fixed?
public follow(element, ref:) {
element.clearCache();
return new Observable((observer) => {
from(element.follow(ref))
.subscribe(refData => {
from(refData.get())
.subscribe(data => {
observer.next(data);
});
});
});
}
...
const projectListClient = new Client('resources/projects')
return this.follow(projectListClient, HateoasLink.SELF)
.pipe(
tap((data: any) => {
this.hateoasDataRoot = data;
if (data.getEmbedded()) {
// .getEmbedded returns an empty array
}
})
)
...
The response structure from the resources/projects
endpoint looks like that:
{
"_embedded":{
"projects":[
{
--- DATA FOR A SPECIFIC PROJECT ---
"_links":{
--- LINKS FOR A SPECIFIC PROJECT ---
},
"_templates":{
--- ACTIONS FOR A SPECIFIC PROJECT ---
}
}
]
},
"_links":{
"self":{
"href":"http://localhost:4200/resources/projects"
}
}
}
-
Checked out other issues. A specific followAll(‘projects’) callback as suggested in https://github.com/badgateway/ketting/issues/273 and https://github.com/badgateway/ketting/issues/275 returns an empty array also.
-
Commented out element.clearCache(); Same result - empty array
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
How to make HATEOAS render empty embedded array
1 Answer 1. Sorted by: Reset to default. Highest score (default) ...
Read more >Embedded document without any properties is persisted as an ...
Hi, I just noticed some strange behavior with Embedded documents. In case there is @EmbedOne'd document with none of the fields set and...
Read more >empty - Manual - PHP
Evaluates as true because $var is set if (isset($var)) { echo '$var is set even though it is empty'; } ?> Example #2...
Read more >Embedded Data - Qualtrics
Embedded data is any extra information you would like recorded in your survey data in addition to the question responses. It can be...
Read more >Javascript remoting method call returning empty array
Unfortunately, I find the documentation on this feature to be confusing and my Javascript is getting an empty array despite my method returning...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I opened #408 and #409 to address both issues.
@mszalomski I think that’s an excellent idea. Glad you figured this out. I’m going to reopen this ticket with an updated title.