Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support dot notation for nested objects in @Expose decorator #195

Open
NoNameProvided opened this issue Oct 26, 2018 · 4 comments
Open
Labels
flag: needs discussion Issues which needs discussion before implementation. flag: needs docs Issues or PRs which still need documentation added. type: feature Issues related to new features.

Comments

@NoNameProvided
Copy link
Member

Currently @Expose decorator supports only flat re-naming, there were multiple requests to add support nested exposing.

Example:

class Example {
  @Expose('user.fullName')
  name: string = 'Test Name';
}

const raw = { user: { fullName: 'Test Name' }}
const instance = new Example();

plainToClass(Example, raw) // returns Example { name: 'Test Name' }
classToPlain(instance) // returns { user: { fullName: 'Test Name' }}
@NoNameProvided NoNameProvided added type: feature Issues related to new features. flag: needs docs Issues or PRs which still need documentation added. flag: needs discussion Issues which needs discussion before implementation. labels Oct 26, 2018
@ziadalzarka
Copy link

Any updates?

@sadra
Copy link

sadra commented May 31, 2020

This feature not implemented yet?

@Dracks
Copy link

Dracks commented Sep 19, 2022

I would need this feature in something I'm doing, and I think I will discard the class-transformer for what I'm doing right now, Maybe is better to have the option of an array, more than . notation, something like
expose(["user","fullName"])

dotNotation should work for my case, but I think it's allways more safe to use an array.

@dimas-cyriaco
Copy link

This would be really useful for working with json:api objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: needs discussion Issues which needs discussion before implementation. flag: needs docs Issues or PRs which still need documentation added. type: feature Issues related to new features.
Development

No branches or pull requests

5 participants