proteanhq/protean

Value object not getting constructed

advishnuprasad opened this issue · 0 comments

My entity and value object structure

@domain.value_object(aggregate_cls='Resource')
class File:
    url = String(required=True, max_length=1024)
    type = String(max_length=15, choices=FileType)
@domain.entity
class Resource:
    title = String(required=True, max_length=50)
    associated_file = ValueObjectField(File, required=True)

    class Meta:
        provider = 'dict'

When I create multiple resources, the value objects are not getting assigned.

for row in reader:
    resource = Resource(
        title=row['Title'],
        associated_file_url=row['File URL'],
        associated_file_type=row['File Type'],
    )
    resource_repo.add(resource)

associated_file_url and associated_file_type are assigned randomly with a single value.