Skip to content

question: @Expose decorator with toClassOnly in not working as expected  #366

Closed
@AdamBialobrzewskiTR

Description

@AdamBialobrzewskiTR

I have that class.

Article {
    @Expose({ name: "_id", toClassOnly: true })
    private id: string;
}

In comming Json:

{
  "_id":"asdasdas"
}

I have _id, but I have to return in response Json id, like

{
  "id":"asdsdads"
}

Function: classToPlain(article) returns that json:

{
  "_id":"asdasdas"
}

but when I view variable article, structure are correct.

Why function classToPlain ignoring @Expose({ name: "_id", toClassOnly: true })

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: cannot reproduceBug reports which cannot be reproduced.type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions