We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you specify a null property type for an Entity class as a Union type such as "string | null", the property is not automatically mapped.
In Destination class file test.entity.ts
@AutoMap() @Column({ type: 'text', nullable: true }) test?: string | null;
In Source class file test.dto.ts
@AutoMap() @IsString() @IsOptional() test?: string | null;
No response
const dto = new TestDto(); dto.test = "test string"; const entity = this.mapper.map(dto, TestDto, TestEntity); console.log(entity);
The results I expected are as follows
{ "test": "test string" }
But in reality,
{ }
@automapper/core
@automapper/classes
@automapper/nestjs
@automapper/pojos
@automapper/mikro
@automapper/sequelize
8.7.7
The text was updated successfully, but these errors were encountered:
However, if you modify the AutoMap Decorator in the Entity file as follows, it will work fine.
@AutoMap(() => String) // <-- implicit String constructor @Column({ type: 'text', nullable: true }) test?: string | null;
Sorry, something went wrong.
However, if you modify the AutoMap Decorator in the Entity file as follows, it will work fine. @AutoMap(() => String) // <-- implicit String constructor @Column({ type: 'text', nullable: true }) test?: string | null;
Hi, this is doesn't work for me( Only if I add @AutoMap(() => String) both to the entity and dto.
@AutoMap(() => String)
What if the value is Enum ?
No branches or pull requests
Is there an existing issue for this?
Describe the issue
If you specify a null property type for an Entity class as a Union type such as "string | null", the property is not automatically mapped.
Models/DTOs/VMs
In Destination class file test.entity.ts
In Source class file test.dto.ts
Mapping configuration
No response
Steps to reproduce
Expected behavior
The results I expected are as follows
But in reality,
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.7.7
Additional context
No response
The text was updated successfully, but these errors were encountered: