You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using plainToClass with a plain object in combination with @type and a discriminator, it will delete the discriminator from that plain object.
A workaround is either to clone the object, or to have keepDiscriminatorProperty set to true on the @type definition. But then it will also be kept in the target object.
I think the root cause is in TransformOperationExecutor.ts on line 51: if (!targetType.options.keepDiscriminatorProperty) delete subValue[targetType.options.discriminator.property];
I can't make a fix / PR right now because of lack of time, but I like to have the issue documented here.
The text was updated successfully, but these errors were encountered:
When using plainToClass with a plain object in combination with @type and a discriminator, it will delete the discriminator from that plain object.
A workaround is either to clone the object, or to have
keepDiscriminatorProperty
set to true on the @type definition. But then it will also be kept in the target object.I think the root cause is in TransformOperationExecutor.ts on line 51:
if (!targetType.options.keepDiscriminatorProperty) delete subValue[targetType.options.discriminator.property];
I can't make a fix / PR right now because of lack of time, but I like to have the issue documented here.
The text was updated successfully, but these errors were encountered: