Skip to content

[Bug/Feature Request] When mapping to a class with fields which are not belonging to same class, error occurs. #33

@jinskjoy

Description

@jinskjoy

Say class A has a field called field1 which is instance of class B.
Class C has field1 which is instance of class D
Mapping directly from A->D is failing unless we register mapping from B->D

class B:
pass
class A:
field1: B
class D:
pass
class C:
field1: D

mapper.to(C).map(A()) - fails

mapper.add(B,D)
mapper.to(C).map(A()) - now succeeds

Example fiddle : https://python-fiddle.com/saved/8999c303-a806-417c-9bdd-d3f3f5206513

It would be great if the mapper automatically handle this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions