Skip to content

Different @Expose rules for transforming to class or plain objects #253

Closed
@fatihky

Description

@fatihky

I want to allow only some groups to be able to set a property's value and different groups to see that property's value. When I use two @Expose() calls on the same property, first @Expose() call gets ignored.

Here is an example:

class User {
  // Determine who can set email property's value
  @Expose({
    groups: ['register', 'admin'], // email can only be set on register and can only be updated by the admin
    toClassOnly: true
  }) // second call

  // Determine who can see email of user instances.
  @Expose({
    toPlainOnly: true // I want everyone to be able to see email.
  }) // first call
  email: string
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: superset by anotherIssue or task being tracked/handled in a different issue.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