question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getEmbedded() returns empty Array despite the set embedded response

See original GitHub issue

First 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"
      }
   }
}
  1. 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.

  2. Commented out element.clearCache(); Same result - empty array

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
evertcommented, Dec 1, 2021

I opened #408 and #409 to address both issues.

1reaction
evertcommented, Dec 1, 2021

@mszalomski I think that’s an excellent idea. Glad you figured this out. I’m going to reopen this ticket with an updated title.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found