Skip to content

dbeaver/pro#7769 fix properties mapping for enums#4052

Merged
sergeyteleshev merged 11 commits intodevelfrom
dbeaver/pro#7769-fix-properties-mapping-for-enums
Jan 27, 2026
Merged

dbeaver/pro#7769 fix properties mapping for enums#4052
sergeyteleshev merged 11 commits intodevelfrom
dbeaver/pro#7769-fix-properties-mapping-for-enums

Conversation

@HocKu7
Copy link
Copy Markdown
Contributor

@HocKu7 HocKu7 commented Jan 13, 2026

Closes https://github.com/dbeaver/pro/issues/7769

What changed

Now, values inside ObjectPropertyInfo (validValues and defaultValue) can be objects with { displayName, value }.

I created two additional functions to use when iterating over validValues or when getting a property value without considering the data type as getObjectPropertyValue fn relies on property type (for example, in the properties table).
Also there is a custom interface for object property so we can change type there and get type errors in our codebase. Previously there were not errors as types were always any.

However, it’s becoming clear that ObjectPropertyInfo is getting more complex to work with. Maybe we should consider implementing an ObjectViewerPropertyMapper class and use it like ObjectViewerPropertyMapper(property).defaultValue. If we always map properties through this object, the behavior would be more predictable in theory.

@devnaumov devnaumov requested review from Nexus6v2, SychevAndrey, Wroud, sergeyteleshev and yagudin10 and removed request for Wroud January 16, 2026 15:56
Comment thread webapp/packages/core-sdk/src/getObjectPropertyValue.ts
}

return value.displayName || value.value || JSON.stringify(value);
return value.value || value.displayName || JSON.stringify(value);
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 change will affect behaviour of the getObjectPropertyDisplayValue probably in unexpected way

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Surely will but its right now. We just need to run auto-tests and fix the cases appeared in-place

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.

I think this is kind of expected. getObjectPropertyDisplayValue is intended to get property.value, always as a string, not property.displayName. Falling back to displayName is more of a last resort here and probably should be removed, since it’s not related to the property value.

The good news is that we use getObjectPropertyDisplayValue only in the metadata viewer, so it will be easy to check.

sergeyteleshev
sergeyteleshev previously approved these changes Jan 20, 2026
}

return value.displayName || value.value || JSON.stringify(value);
return value.value || value.displayName || JSON.stringify(value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Surely will but its right now. We just need to run auto-tests and fix the cases appeared in-place

Wroud
Wroud previously approved these changes Jan 21, 2026
@sergeyteleshev sergeyteleshev merged commit 0bfdcf0 into devel Jan 27, 2026
10 checks passed
@sergeyteleshev sergeyteleshev deleted the dbeaver/pro#7769-fix-properties-mapping-for-enums branch January 27, 2026 11:53
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.

7 participants