To hide the id attribute, you need to declare this field hidden.
In the file YOUR_MODEL.json:
{ "name": "YOUR_MODEL", . . . "properties": { // your custom properties }, "hidden": ["id"], // this attribute specifies which attributes need to be hidden . . . }
Remember when a property is declared as hidden:
- It is not displayed to the user.
- Although hidden, if the user submits, assigns a value to this property, the property will not be ignored by default and will be processed with the provided values . therefore, you must ignore it manually.
For example, if we have a User model as follows:
{ "name": "User", . . . "properties": { "id": "string", "name": "string", "password": "string", }, "hidden": ["id", "password"], . . }
/api/User GET request will provide a list of users with attribute only
BUT, /api/User POST with the body:
{ "user" : "USER", "password": "PASS", "id" : "USER_PROVIDED_ID" }
the user provided in the body will be saved with the values ββin it.
Reuven chacha
source share