mapper icon indicating copy to clipboard operation
mapper copied to clipboard

Does not work with introspectComments with @nestjs/swagger plugin

Open RaviVadera opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the issue

AutoMapper transformer plugin @automapper/classes/transformer-plugin fails to map classes when

  • combined with @nestjs/swagger plugin
  • introspectComments set to true
  • doc comment defined on properties

Just removing doc comments from the property seems to work.

Models/DTOs/VMs

DTO

export default class PatchDto {
  /**
   * Software version
   * @example 0.1.0
   */
  @IsNotEmpty()
  @IsString()
  swVersion: string;
}

Model

export default class Patch {
  swVersion: string;
}

Mapping configuration

createMap(mapper, PatchDto, Patch);

Steps to reproduce

// console.log(patchModel); => Patch {}
const patchModel = await this.mapper.mapAsync(patchDto, PatchDto, Patch);

Expected behavior

The mapped object should have all properties.

Screenshots

No response

Minimum reproduction code

No response

Package

  • [ ] I don't know.
  • [X] @automapper/core
  • [X] @automapper/classes
  • [X] @automapper/nestjs
  • [ ] @automapper/pojos
  • [ ] @automapper/mikro
  • [ ] @automapper/sequelize
  • [ ] Other (see below)

Other package and its version

No response

AutoMapper version

8.7.7

Additional context

Ubuntu Node v16 Nest v9

RaviVadera avatar Dec 19 '22 10:12 RaviVadera