You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hats off for being so active in the first place.
I'm experiencing something similar to #181 . The Mapper is configured properly and works as well. Just the JSON key/value pairs after mapping are in reversed order.
EDIT: I'll give you some context about the behavior if you're interested.
The "problem" was from: mappingProperties.unshift() in createInitialMapping() function. createInitialMapping() is the function that gets called when you call: createMap(mapper, Source, Destination).
Normally, the Mapper will grab the metadata from AutoMap and process those into MappingProperties. These are so-called "Auto Configuration".
Optionally, you can pass one or many forMember() calls to "customize" the mapping instruction for each property. These "Manual/Custom Configurations" are always run FIRST.
mappingProperties.unshift() makes sure that the "Auto Configurations" are placed BEFORE the "Manual/Custom Configurations" because the "Manual/Custom Configurations" should take precedence over the "Auto Configurations"
exportclassUserEntity{
@AutoMap()id!: number;}exportclassUserResponse{
@AutoMap()id!: number;}createMap(mapper,UserEntity,UserResponse);// "id" is auto-configuredcreateMap(mapper,UserEntity,UserResponse,forMember(d=>d.id,fromValue(Math.random()))// "id" is custom-configured and this should take precedence)
Is there an existing issue for this?
Describe the issue
Hello @nartc,
hats off for being so active in the first place.
I'm experiencing something similar to #181 . The Mapper is configured properly and works as well. Just the JSON key/value pairs after mapping are in reversed order.
Models/DTOs/VMs
UserEntity Class:
UserResponse Class
Mapping configuration
This is the automapper profile:
Steps to reproduce
No response
Expected behavior
Expected:
Actual response from mapper
Screenshots
No response
Minimum reproduction code
No response
Package
@automapper/core
@automapper/classes
@automapper/nestjs
@automapper/pojos
@automapper/mikro
@automapper/sequelize
Other package and its version
No response
AutoMapper version
8.4.1
Additional context
NestJs v8.0.0
Node v16.16.0
The text was updated successfully, but these errors were encountered: