Skip to content

Fix XSD type name mapping for UnsignedInt and UnsignedByte#563

Open
gaoflow wants to merge 1 commit into
eclipse-basyx:mainfrom
gaoflow:fix-560-xsd-unsigned-type-names
Open

Fix XSD type name mapping for UnsignedInt and UnsignedByte#563
gaoflow wants to merge 1 commit into
eclipse-basyx:mainfrom
gaoflow:fix-560-xsd-unsigned-type-names

Conversation

@gaoflow
Copy link
Copy Markdown

@gaoflow gaoflow commented Jun 4, 2026

Problem

XSD_TYPE_NAMES in basyx/aas/model/datatypes.py mapped UnsignedInt to "unsignedByte" and had no entry for UnsignedByte at all.

Because XSD_TYPE_CLASSES is generated as the inverse of XSD_TYPE_NAMES, this produced two concrete failures (the deserializers look the value type up in XSD_TYPE_CLASSES, e.g. json_deserialization.py / xml_deserialization.py):

  • XSD_TYPE_CLASSES["xs:unsignedInt"] was absent, so deserializing any Extension, Property, Qualifier, … with valueType: xs:unsignedInt raised KeyError.
  • XSD_TYPE_CLASSES["xs:unsignedByte"] returned UnsignedInt instead of UnsignedByte — a silent wrong-class result.

Fix

Map UnsignedInt to "unsignedInt" and add the missing UnsignedByte: "unsignedByte" entry.

Tests

Added TestIntTypes.test_xsd_type_name_mapping, which checks the two specific mappings round-trip and, more generally, that XSD_TYPE_CLASSES is a faithful inverse of XSD_TYPE_NAMES for every type (so no two types share an XSD name). It fails on main and passes with the fix. The existing test_datatypes and JSON/XML serialization tests stay green.

Fixes #560.

XSD_TYPE_NAMES mapped UnsignedInt to "unsignedByte" and had no entry for
UnsignedByte. Since XSD_TYPE_CLASSES is the inverse, deserializing a value
with valueType "xs:unsignedInt" raised KeyError, and "xs:unsignedByte"
resolved to UnsignedInt instead of UnsignedByte. Map each type to its own
XSD name. Fixes eclipse-basyx#560.

Signed-off-by: gaoflow <gaobing1230@gmail.com>
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.

model.datatypes: UnsignedInt mapped to wrong XSD name, UnsignedByte missing from XSD_TYPE_NAMES

1 participant