Isn't nested mapping supported? #404
-
Hi, first of all: Thanks for this amazing library! Having a .net background it's a pleasure 😅 I'm wondering if nested mapping isn't supported or I'm doing something wrong 🤔 Let's say I have the following classes: class Tenant {
@AutoMap()
id: string;
@AutoMap()
name: string;
}
class User {
@AutoMap()
id: string;
@AutoMap({ typeFn: () => Tenant })
tenant: Tenant;
}
class UserModel {
@AutoMap()
id: string;
@AutoMap()
tenantId: string;
@AutoMap()
tenantName: string;
} I want to map I was able to fix this by specifying the mapping manually but would have expected that this works out-of-the-box. Is that the expected behaviour? Here is a CodeSandbox that demonstrates the behaviour: https://codesandbox.io/s/automapper-y6xoj?file=/src/index.ts |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@tim-hoffmann Thank you for the kind words. Yes, unfortunately, this is the expected behavior. Reverse Mapping flattened fields back into objects has been proving very difficult to do :(. Manual mapping is the way to go here sadly. |
Beta Was this translation helpful? Give feedback.
@tim-hoffmann Thank you for the kind words. Yes, unfortunately, this is the expected behavior. Reverse Mapping flattened fields back into objects has been proving very difficult to do :(. Manual mapping is the way to go here sadly.