Skip to content

_normalize_inlined passes positional args to slot_type, breaks when key field is not first __init__ parameter #3244

@dalito

Description

@dalito

_normalize_inlined in yamlutils.py instantiates slot_type using positional arguments in three places. This assumes the key/identifier field is the first parameter of init. With dataclass inheritance, parent fields come before child fields in the MRO, so a key field declared on a subclass is not the first parameter. The positional call assigns the value to the wrong field, leading to silent data corruption or ValueError.

Found in nfdi-de/dcat-ap-plus#64 after upgrading to linkml 1.10.0, which started generating _normalize_inlined_as_list for the other_identifier slot with key_name="notation". The Identifier class has is_a: SupportiveEntity (contributing title, description), making notation the third init parameter.

Update: The tests added in the linked PR include small example schemas that should help to understand when the issue is observed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions