Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

items.MyItem.type no longer includes "Item" in the type #327

Closed
rkoshak opened this issue Apr 9, 2024 · 1 comment
Closed

items.MyItem.type no longer includes "Item" in the type #327

rkoshak opened this issue Apr 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rkoshak
Copy link
Contributor

rkoshak commented Apr 9, 2024

Expected Behavior

Previous to now the type of the Item was a String version of the last part of the rawItem's classname. For example a String Item was "StringItem".

Current Behavior

The behavior changed and now the type no longer includes the "Item" portion of the type.

While I kind of like this change it is definitely a breaking change and the break was not clearly described in the 4.2 M2 announcements.

The change in behavior appears to have been introduced in PR #325 but it's not clear why the change was made from this.rawItem.getClass().getSimpleName(); to return this.rawItem.getType().toString(); and the description of the PR does not indicate this behavior changed.

Possible Solution

I really have no problem with the change itself but it has unexpectedly broken at least one of my rule templates, maybe more. As a breaking change it should at least be clearly described in the release notes.

Steps to Reproduce (for Bugs)

  1. console.log(items.SomeItem.type); and notice that the "Item" part of the result is omitted.

Context

Your Environment

  • Version used: (e.g., openHAB and JS Scripting add-on version) OH 4.2 M2, openhab-js 4.9.0
@rkoshak rkoshak added the bug Something isn't working label Apr 9, 2024
@florian-h05
Copy link
Contributor

Seems like I overlooked this in the PR description and therefore it is also missing in the release notes.

I will adjust the CHANGELOG and add a warning.

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

No branches or pull requests

2 participants