[go: up one dir, main page]

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

Explicitly pass type to array in AutoMap decorator when a class gets extended using MapperOmitType #557

Open
4 of 9 tasks
FurqanAthar opened this issue Jun 26, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@FurqanAthar
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

When a class, having an attribute whose value is an array of custom class, is extended by another class via MapperOmitType, it produces an error in inheritAutoMapMetadata -> getMetadataList -> isDateConstructor and automaps the fields incorrectly. This issue is produced because the metaDataList gets the array type from the AutoMap decorator as undefined on null and the isDateConstructor then throws the error that undefined cannot be converted.

Here is the class that is extending PersonnelUpdateInput and the PersonnelUpdateInput class has the AutoMap decorator with array type explicitly defined.
Screenshot from 2023-06-26 12-14-14

Here is the PersonnelUpdateInput attribute:
Screenshot from 2023-06-26 12-13-57

And here is the error
Screenshot from 2023-06-26 12-13-41

https://automapperts.netlify.app/docs/strategies/classes#array-type

Models/DTOs/VMs

No response

Mapping configuration

No response

Steps to reproduce

No response

Expected behavior

Should work fine with array types defined explicitly

Screenshots

No response

Minimum reproduction code

No response

Package

  • I don't know.
  • @automapper/core
  • @automapper/classes
  • @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

No response

@FurqanAthar FurqanAthar added the bug Something isn't working label Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant