mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 178 forks source link

hydrate an object by ignoring the extra field #605

Open KyDenZ opened 6 years ago

KyDenZ commented 6 years ago

What type of issue are you creating?

What version of this module are you using?

Hello,

I would like to know if there is a simple technique to hydrate a model to send it to the API without taking into account the additional fields.

I'm not a fan of the technique of creating a temporary object or removing elements from a form to send to the API such as:

const user: User = {
       username: this.registerForm.value.userName,
       lastname: this.registerForm.value.userName
};

or

delete this.registerForm.value.confirmPassword

So I wonder if there will be a technique to hydrate an object without taking into account the elements that are not present in the basic object.

Thank you for your answers.