Hidden properties
Description / Steps to reproduce / Feature proposal
Does Loopback 4 supports hidden properties like LB3 did?
Current Behavior
I could not find any docs or resources about this.
Expected Behavior
https://loopback.io/doc/en/lb3/Model-definition-JSON-file.html#hidden-properties
@bajtos Thanks. Will see how can I help @frbuceta on this. I am on vacation on coming few days. Will start on it next week.
@frbuceta let me know how can I help you on this. The current solution is a short-term solution but I believe we should enhance it to full blown solution?
@bhupesh-sf I'm beginning to understand how this is going. But yes, we can work on a better solution
@bajtos Although its not related to the current issue but do you think to have internal properties for the model. Use case could be some kind of calculated properties which can be only internally created/updated and I don't want them to be the part of request but of the response??
Syntax could be something like
{
name: orderTotal,
isInternal: true
}
@frbuceta, since your PR #3304 has landed, is this issue good to close? Thanks.
@frbuceta, since your PR #3304 has landed, is this issue good to close? Thanks.
Yes, it can be closed. Something provisional has been launched to my liking but someday the time will come to do it better
This problem is solved? I still have the same problem. I put the decorator in model:
@model({
settings: {
hiddenProperties: ['Password'],
strict: false,
},
})
and the response still show de Password property.

This problem is solved? I still have the same problem. I put the decorator in model:
@model({ settings: { hiddenProperties: ['Password'], strict: false, }, })and the response still show de Password property.
I don't know what exactly is happening but it works for me
@model({
name: 'users',
settings: {
hiddenProperties: ['password'],
},
})
export class User extends Entity {
...
@property({
type: 'string',
required: true,
jsonSchema: {
minLength: 8,
},
})
password: string;
...
}
The problem is with de setting "strict: false", if eliminate that, works well, Is it normal or is an error?
The problem is with de setting "strict: false", if eliminate that, works well, Is it normal or is an error?
I investigate it
@joel-izaguirre In the next version of LoopBack (in a few days) it will work
@joel-izaguirre In the next version of LoopBack (in a few days) it will work
Still not working, or I miss something?
@mycolaos, how are you using the hiddenProperties? Could you please take a look at https://github.com/strongloop/loopback-next/issues/6385?
@dhmlau like this:
@model({
settings: {
hiddenProperties: ['password']
}
})
Reopening this issue to be able to track this issue.
@mycolaos, I just tried it with the latest LB4 modules and seems to be working for me. My Customer model has:
- custId
- name
- password <-- hidden property, defined the same way as you did.
Then I tested it with API explorer,
- POST
{
"name": "name1",
"password": "pwd1"
}
- GET
[
{
"custId": "1",
"name": "name1"
}
]
Is it what you're seeing too?
@dhmlau I believe I found the problem. I have an abstract class MyEntity that is than extended by other models. MyEntity has the hiddenProperties options, but it doesn't work. If I decorate with hiddenProperties the final model that extends MyEntity - it works.
Then, how I can make it work with MyEntity?
@model({
settings: {
hiddenProperties: ['OTP', 'providerId', 'password', 'isDelete'],
},
})
This is worked for me., try this