Skip to content

handling hyphenated keys in example_runner._load_from_dict () #3318

@noelmcloughlin

Description

@noelmcloughlin

Describe the bug
This is minor issue, but linkml-run-examples fails when YAML data contains hyphenated keys (i.e. how-many).
YAML allows hyphenated keys but they cannot be Python identifier kwargs.

Cause
_load_from_dict passes original YAML dictionary keys as **kwargs directly into py_target_class(**new_dict_obj) without normalizing hyphenated key values.

Workaround
Ensure --no-use-type-designators is passed to linkml-run-examples in the justfile recipe, allowing validation by the JSON validator (which already uses underscored property names).

Example Data

            - id: ac-01_odp.03
              props:
                - name: alt-identifier
                  value: ac-1_prm_2
                - name: label
                  value: AC-01_ODP[03]
                  class: sp800-53a
              select:
                how-many: one-or-more                     <----------- Hyphenated key
                choice:
                  - organization-level
                  - mission/business process-level
                  - system-level

Version of LinkML you are using

linkml, version 1.1.13.post3593.dev0+5f3601b9

Metadata

Metadata

Labels

bugSomething that should work but isn't, with an example and a test case.community-generated

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions