https://jsbin.com/cevevaq/edit?js,output
<Button> (just as an example).type-property is not a value from sap.m.ButtonType.The following error should be thrown:
Uncaught Error: "somethingInvalid" is of type string, expected sap.m.ButtonType
No error thrown. This might lead one thinking that the assigned (enum) value is correctly applied which is not immediately noticeable in some cases.
width throws the error expectedly in XML views.Hi @boghyon,
Thanks for sharing your finding. I have created an internal incident 1880543609, [GITHUB] Issue in sap.m.Button - Type validation. The status of the issue will be updated here in GitHub.
Regards, Irina
Hi Irina, I just wanted to clarify that this isn't just about sap.m.Button. As far as I could see, this issue applies to all Controls in declarative views. The Button was just as an example.
Hi,
Yes, sure, thank you. I ‘ ll add it to the internal message.
Best regards,
Irina
From: Boghyon Hoffmann notifications@github.com
Reply-To: SAP/openui5 reply@reply.github.com
Date: Monday, 20. August 2018 at 10:00
To: SAP/openui5 openui5@noreply.github.com
Cc: Irina Goetzenberger irina.goetzenberger@sap.com, Comment comment@noreply.github.com
Subject: Re: [SAP/openui5] Assigning Values in XML View Bypasses Validation of Certain Types (#2166)
Hi Irina, I just wanted to clarify that this isn't just about sap.m.Button. As far as I could see, this issue applies to all Controls in declarative views. The Button was just as an example.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/SAP/openui5/issues/2166#issuecomment-414231004, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJOclRKfn4JdseQOF4HJu8j-PUdpDNkYks5uSmyvgaJpZM4WAE5V.
It seems that with 1.28, there was an error in this case, but in any newer version it is gone: https://jsbin.com/penaziw/1/edit?html,js,output
It also doesn't seem to be related to sync/async processing or the new create API.
Hi @boghyon,
we looked at this issue and the root cause is a refactoring on the sap/ui/base/DataType implementation (roughly 3 and a half years ago...).
The original error @matz3 mentioned is created from the ManagedObject constructor, when a type validation fails.
During XML processing, the behavior differs a bit and cannot easily changed.
We will discuss how we can enhance the current behavior in a compatible way.
The result will probably an error logging only, as throwing an exception might break existing applications (built in the last couple years).
BR,
thodd
The result will probably an error logging only, as throwing an exception might break existing applications
Sounds good. As long as there is some type of notification for the developer that a wrong type was used..
If applicable, I think an additional support rule checking whether the right type was used or not would be also beneficial.
PS:
Concerning the support rule: not implemented yet, we will discuss when to tackle this.
Right now we only added a better logging for the issue.
@Thodd Sorry, I think the issue is not completely resolved. It works for enum types but for other types such as boolean, no errors are logged.
In https://jsbin.com/cevevaq/edit?js,console,output, we can see that only the error log for the Button type is logged whereas there is no error log for the invalid iconFirst value (e.g. "notBoolean").