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

Attributes that share common prefixes get skipped #583

Open
3 of 9 tasks
erenteria-cu opened this issue Oct 24, 2023 · 0 comments
Open
3 of 9 tasks

Attributes that share common prefixes get skipped #583

erenteria-cu opened this issue Oct 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@erenteria-cu
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

When mapping attributes with names that have similar prefixes, the attributes whose names that contain more than just the prefix get skipped.

For instance, if I have a source class like this:

class Src {

    @AutoMap()
    deleted: boolean;

    @AutoMap()
    deleted_by: number;

}

And a destination class like this:

class Dst {

    @AutoMap()
    deleted: boolean;

    @AutoMap()
    deletedBy: number;

}

And a mapping like this:

        createMap(
            mapper,
            Src,
            Dst,
            namingConventions({
                source: new SnakeCaseNamingConvention(),
                destination: new CamelCaseNamingConvention(),
            }),

When I try to map a source object to the destination, the destination only contains the deleted attribute. The deletedBy attribute is undefined.

Models/DTOs/VMs

class Dst {

    @AutoMap()
    deleted: boolean;

    @AutoMap()
    deletedBy: number;

}

class Dst {

    @AutoMap()
    deleted: boolean;

    @AutoMap()
    deletedBy: number;

}

Mapping configuration

        createMap(
            mapper,
            Src,
            Dst,
            namingConventions({
                source: new SnakeCaseNamingConvention(),
                destination: new CamelCaseNamingConvention(),
            }),

Steps to reproduce

No response

Expected behavior

I would expect both the deleted and deletedBy attributes to be properly mapped.

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.6

Additional context

No response

@erenteria-cu erenteria-cu added the bug Something isn't working label Oct 24, 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