Skip to content

feature: Expose JS object(Record) should work when strategy='excludeAll'  #709

Open
@Nikolay-Uvarov

Description

@Nikolay-Uvarov

Description

We use default strategy excludeAll and created the following class:

export class Data { @Expose() @IsOptional() public metadata?: Record<string, unknown>; }

But after transformation we got metadata field is empty object. All metadata field keys are removed in getKeys method.
It will be great if there are all fields from metadata property after transformation.
We found workaround but we think it is not good enough.

export class DownloadData { @Expose() @IsOptional() @Transform((value) => value.obj?.metadata) public metadata?: Record<string, unknown>; }

Proposed solution

For example, add to @Expose() a property { strategy: 'exposeAll' }. (@Expose('exposeAll' )).

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: needs discussionIssues which needs discussion before implementation.type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions