Skip to content

fix: xsd:string and PRIMITVE datatypes fix#180

Closed
kiph-soptim wants to merge 2 commits into
mainfrom
fix/xsdstring-fix
Closed

fix: xsd:string and PRIMITVE datatypes fix#180
kiph-soptim wants to merge 2 commits into
mainfrom
fix/xsdstring-fix

Conversation

@kiph-soptim

@kiph-soptim kiph-soptim commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

fixes that xsd:string was converted to xsd:String and that PRIMITIVE datatypes were converted to xsd datatypes

Related Issues

Checklist

  • Tests added or updated (or not applicable)
  • Documentation updated (or not applicable)
  • No breaking changes introduced (or described in the summary above)
  • Commits are signed off (git commit -s) for DCO

Testing Notes

@spah-soptim spah-soptim self-requested a review June 15, 2026 11:04
@spah-soptim spah-soptim added the bug Something isn't working label Jun 15, 2026
default CIMSDataType buildDataType(DataTypeDTO dto) {
URI uri;
if (dto.getType() == DataTypeDTO.Type.PRIMITIVE) {
if (dto.getPrefix().equalsIgnoreCase(XSD.getURI())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataTypeDTO.prefix comes from URI, which splits on #.

So any datatype with a URI that uses / as separator (i.e. http://example.com/test) throws NullPointerException.

Safe guard it:

Suggested change
if (dto.getPrefix().equalsIgnoreCase(XSD.getURI())) {
if (XSD.getURI().equalsIgnoreCase(dto.getPrefix())) {

if (dto.getDataType() == null || dto.getDataType().getLabel() == null) {
return null;
}
if (dto.getDataType().getType() != DataTypeDTO.Type.PRIMITIVE) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add a prefix-based check here. A PRIMITIVE with a non-XSD prefix whose label collides with a real XSD type name (e.g. label "string") gets normalized to xsd:string here.
Is that intended?

while (typeListIterator.hasNext()) {
var dt = typeListIterator.next();
if (dt.getURI().equalsIgnoreCase(xsdUri)) {
if (primitiveDatatypeClassLabel.equals("string")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "string" special case is undocumented and untested.
Future reader has no way to know why string alone needs exact matching while very other label is case-insensitive.
Add a comment why.
Maybe add unit test for XSDDatatypeMapper covering string and String.

@kiph-soptim kiph-soptim deleted the fix/xsdstring-fix branch June 15, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants