This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Regression in Entity "hiddenProperty" behavior when creating a new entity via SequelizeCrudRepository#create #37
Comments
It does but the model in this case will be sequelize model which doesn't inherit the loopback's model so a way to replicate similar behaviour for sequelize's model class would help. Will se what can be the done for this. PS: Thanks so much for testing things out for this package. I would appreciate if you could post future issues on loopback-next as It's easier for me to point these issue in fix PRs. |
No problem! I'm eager to get this working. I'll post issues in Loopback Next instead going forward. |
RaghavaroraSF
added a commit
that referenced
this issue
Jun 12, 2023
Fixed Regression in Entity \"hiddenProperty\" behavior when creating a new entity via SequelizeCrudRepository#create GH-37
12 tasks
RaghavaroraSF
added a commit
that referenced
this issue
Jun 12, 2023
shubhamp-sf
added a commit
that referenced
this issue
Jun 13, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. Which prevented users from accessing those fields on backend. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. GH-37
12 tasks
shubhamp-sf
added a commit
that referenced
this issue
Jun 13, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. Which prevented users from accessing those fields on backend. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. GH-37
shubhamp-sf
added a commit
to shubhamp-sf/loopback-next
that referenced
this issue
Jun 13, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
8 tasks
shubhamp-sf
added a commit
to shubhamp-sf/loopback-next
that referenced
this issue
Jun 13, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
shubhamp-sf
added a commit
to shubhamp-sf/loopback-next
that referenced
this issue
Jun 14, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
shubhamp-sf
added a commit
to shubhamp-sf/loopback-next
that referenced
this issue
Jun 14, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
shubhamp-sf
added a commit
to shubhamp-sf/loopback-next
that referenced
this issue
Jun 14, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
shubhamp-sf
added a commit
to shubhamp-sf/loopback-next
that referenced
this issue
Jun 14, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
dhmlau
pushed a commit
to loopbackio/loopback-next
that referenced
this issue
Jun 17, 2023
Previously, the package used a custom `excludeHiddenProps` function to exclude hidden fields. But that prevented users from accessing those fields on backend too. With this change, we now defer to the LoopBack Model's built-in toJSON method, which already handles the exclusion of hidden properties when serializing data for a response. Fixes: sourcefuse/loopback4-sequelize#37 Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
I noticed that Entity properties marked as hidden are not accessible immediately after creation using a repository extending the
SequelizeCrudRepository
.I traced it to this code:
loopback4-sequelize/src/sequelize/sequelize.repository.base.ts
Line 132 in 1de33ea
loopback4-sequelize/src/sequelize/sequelize.repository.base.ts
Line 888 in 1de33ea
To Reproduce
Steps to reproduce the behavior:
Repository.create()
Expected behavior
Hidden properties should be excluded from the REST API responses but still be accessible in the backend.
Additional context
It seems to be related to this PR: 3e254fd
My understanding is that Loopback will call "toJSON" when serializing the response which should already handle excluding the hidden properties: https://github.com/loopbackio/loopback-next/blob/057150d78908045c3ac2405b0ba2aac65eb17416/packages/repository/src/model.ts#L341-L370
It seems like changing this line:
loopback4-sequelize/src/sequelize/sequelize.repository.base.ts
Line 132 in 1de33ea
to the following might be all it takes:
The text was updated successfully, but these errors were encountered: