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)
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
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 thetype
.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();
toreturn 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)
console.log(items.SomeItem.type);
and notice that the "Item" part of the result is omitted.Context
Your Environment