Skip to content

validator: Fix missing '#' stripping from schema ID#192

Merged
robherring merged 1 commit into
devicetree-org:mainfrom
pinchartl:validator-strip-fix
Apr 28, 2026
Merged

validator: Fix missing '#' stripping from schema ID#192
robherring merged 1 commit into
devicetree-org:mainfrom
pinchartl:validator-strip-fix

Conversation

@pinchartl

Copy link
Copy Markdown

Schema IDs contain a trailing '#' which is stripped to create a key to index the schemas dictionary. Stripping is missing in one location, which causes a KeyError exception when a property mixes multiple types:

Traceback (most recent call last):
File "/.local/bin/dt-mk-schema", line 6, in
sys.exit(main())
~~~~^^
File "
/src/tools/dt-schema/dtschema/mk_schema.py", line 28, in main
schemas = dtschema.DTValidator(args.schemas).schemas
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/src/tools/dt-schema/dtschema/validator.py", line 399, in init
self.make_property_type_cache()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "
/src/tools/dt-schema/dtschema/validator.py", line 528, in make_property_type_cache
self.check_duplicate_property_types()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "~/src/tools/dt-schema/dtschema/validator.py", line 522, in check_duplicate_property_types
print(f"{self.schemas[sch_id]['$filename']}: {p}: multiple incompatible types: {v['type']}", file=sys.stderr)
~~~~~~~~~~~~^^^^^^^^
KeyError: 'http://devicetree.org/schemas/crypto/fsl,sec-v4.0.yaml#'

Fix it by stripping the trailing '#' like done in other locations.

Schema IDs contain a trailing '#' which is stripped to create a key to
index the schemas dictionary. Stripping is missing in one location,
which causes a KeyError exception when a property mixes multiple types:

Traceback (most recent call last):
  File "~/.local/bin/dt-mk-schema", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "~/src/tools/dt-schema/dtschema/mk_schema.py", line 28, in main
    schemas = dtschema.DTValidator(args.schemas).schemas
              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "~/src/tools/dt-schema/dtschema/validator.py", line 399, in __init__
    self.make_property_type_cache()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "~/src/tools/dt-schema/dtschema/validator.py", line 528, in make_property_type_cache
    self.check_duplicate_property_types()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "~/src/tools/dt-schema/dtschema/validator.py", line 522, in check_duplicate_property_types
    print(f"{self.schemas[sch_id]['$filename']}: {p}: multiple incompatible types: {v['type']}", file=sys.stderr)
             ~~~~~~~~~~~~^^^^^^^^
KeyError: 'http://devicetree.org/schemas/crypto/fsl,sec-v4.0.yaml#'

Fix it by stripping the trailing '#' like done in other locations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
@robherring robherring merged commit 4ccc199 into devicetree-org:main Apr 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants