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

Mapping with both null and undefined #215

Closed
kami4ka opened this issue Oct 15, 2020 · 7 comments
Closed

Mapping with both null and undefined #215

kami4ka opened this issue Oct 15, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@kami4ka
Copy link

kami4ka commented Oct 15, 2020

This mapper is the most powerful and maintained that I've seen and I appreciate all the job done.

I have a question regarding this mapper.
My app architecture consists of 3 layers: API, domain and database.
While using PATCH I'd like to be able to differentiate null and undefined on the database layer entities.

So my question: is it possible to keep undefined properties as undefined and null properties as null while mapping?

@nartc
Copy link
Owner

nartc commented Oct 22, 2020

@kami4ka Sorry for getting back to you this late. Thanks for the kind words. And thanks for reporting the issue. As of the moment, it's not possible unfortunately. It's either null OR undefined at this point. However, it's entirely possible to fix. With that said, there's also #208 where I'd love to spend a little more time into rethink how I want defaults in AutoMapper to take shape.

I'll look into this as soon as I am settled with the new job (not an excuse but that's why I've been away, I took on a new offer 😉)

@nartc nartc self-assigned this Oct 22, 2020
@nartc nartc added the enhancement New feature or request label Oct 22, 2020
@kami4ka
Copy link
Author

kami4ka commented Oct 22, 2020

@nartc Thanks for the response. Can you please suggest if it's possible somehow to fix the behavior locally?

@nartc
Copy link
Owner

nartc commented Oct 22, 2020

@kami4ka I'm thinking that it's possible and probably is going to require some work. If you could provide a sample repo then I can jump in and hack at it.

@kami4ka
Copy link
Author

kami4ka commented Oct 23, 2020

@nartc It's really a quite simple example with 3 classes that contain the same fields (as we have a 3 layer app).
We're using @AutoMap() decorator for all the fields and just creating maps with .createMap(Request, Domain) and .createMap(Domain, Entity).reverseMap() calls.

@kami4ka
Copy link
Author

kami4ka commented Nov 18, 2020

Hi, @nartc . Any updates regarding this issue? Can I somehow help/contribute?

@abouroubi
Copy link

Would love to see this feature too, I can help if needed

@nartc
Copy link
Owner

nartc commented Dec 17, 2020

Closing this due to #243 . I won't be adding this to the current @nartc/automapper as stated in the announcement. That said, this will be available in the new version. Sorry for any inconvenience.
cc @kami4ka @abouroubi. Sorry for the long delay and ultimately close the issue without a solution. Please read the announcement for the reasons and future changes. Thanks for understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants