Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty arrays stripped from response objects #2368

Closed
nmkataoka opened this issue Feb 11, 2019 · 2 comments
Closed

Empty arrays stripped from response objects #2368

nmkataoka opened this issue Feb 11, 2019 · 2 comments
Labels

Comments

@nmkataoka
Copy link

Description / Steps to reproduce / Feature proposal

Previously, hasMany relations showed up in GET requests as null properties. Now they are stripped out, even if the hasMany properties are filled in manually.

I think it's related to removing the array property from hasMany properties
56ab017
#1944

For example, if User model hasMany Experience models, sometimes we would have GET requests look like:

let user = await this.userRepository.getById(id); user.experiences = await this.userRepository.experiences(profile.id).find(); return user;
Right now, no matter what is in user.experiences, the whole property is stripped from the response. Logging before the response confirms that the object has an experiences array.

I confirmed it's due to a recent change in '@loopback/repository' by changing versions.

Current Behavior

HasMany properties are stripped from responses.

Expected Behavior

If the array is manually populated, it should be returned. We didn't mind returning NULL properties otherwise.

See Reporting Issues for more tips on writing good issues

@stale
Copy link

stale bot commented Feb 6, 2020

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Feb 6, 2020
@stale
Copy link

stale bot commented Mar 8, 2020

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant