Skip to content

Single-valued values that belong to a multivalued slot in the source class do not get mapped #59

Open
@martinwellman

Description

@martinwellman

When mapping a multivalued value, the source value gets properly mapped if it is already a list or a dictionary, but not if it is a single value.

This is due to the following code at object_transformer.py:269:

                if source_class_slot.multivalued:
                    if isinstance(v, list):
                        v = [self.map_object(v1, source_class_slot_range, target_range) for v1 in v]
                    elif isinstance(v, dict):
                        v = {
                            k1: self.map_object(v1, source_class_slot_range, target_range)
                            for k1, v1 in v.items()
                        }
                    else:
                        v = [v]

The last line of code converts the source value to an array, but does not map the actual value. I believe the desired behaviour is to map the value v within the array: v = [self.map_object(v, source_class_slot_range, target_range)]. Correct me if this is not the desired behaviour.

I'll create a PR for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions