Open
Description
Environment
- DiffSync version: 1.7.1
Proposed Functionality
The _identifiers
of a model should allow a reference to the parent's set of _identifiers
.
Use Case
Taking a simple building -> floor parent-child hierarchy the 2nd floor only needs to be unique within its own building. Currently I have to do a workaround like this:
class Floor(DiffSyncModel):
_identifiers = ("name", "building_name")
name: str
building_name: str
when I would much rather want to do something like this
class Floor(DiffSyncModel):
_identifiers = ("name", "$parent")
name: str
to make my floors unique where BuildingModel
looks like this:
class Building(DiffSyncModel):
_identifiers = ("name")
_children = {"floor": "floors"}
name: str
floors: List[Floor] = []