Repository navigation
fix: report invalid MQTT and ROS2 binding scalars as errors - #48
Conversation
Several MQTT and ROS2 binding fields were parsed with Get*ValueOrDefault(), which returns null for a value that cannot be parsed. A document with e.g. `cleanSession: yes-please` or `keepAlive: abc` was read with no diagnostics and the value was silently dropped, so writing it back lost data. These fields now use GetIntegerValue()/GetBooleanValue(), which report "Value could not parse to ..." in diagnostic.Errors, matching the other bindings (IBM MQ, JMS, Kafka, ...): - MQTT server: cleanSession, keepAlive, lastWill.qos - MQTT message: payloadFormatIndicator - ROS2 server: domainId - ROS2 QoS policies: lifespan, deadline, leaseDuration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@VisualBean i drafted it as didnt even had change to test it properly😂 but wanted make you aware of issue |
APPROVED! 😂 I think coderabbit flagged it as well, but I was pretty sure that the last call down the stack took care of it. |
|
Yeah i was reviewing your changes, as i mention it in docs for my package as well: |
Thanks for recent batch. |
|
I am checking few more things so you might wait few more minutes 😂 |
Problem
Some MQTT and ROS2 binding fields silently drop values that don't parse:
This reads with no errors, and writing it back gives
mqtt: { }. The data is lost without any signal to the caller.These fields used
GetIntegerValueOrDefault()/GetBooleanValueOrDefault(), which returnnullwhen parsing fails. Every other binding (IBM MQ, JMS, Kafka, Solace, ...) usesGetIntegerValue()/GetBooleanValue(), which throw anAsyncApiReaderExceptionthat the field parser records as a diagnostic.Change
Switched to the reporting variants for:
cleanSession,keepAlive,lastWill.qospayloadFormatIndicatordomainIdlifespan,deadline,leaseDurationInvalid values now produce
Value could not parse to integer./Value could not parse to bool.indiagnostic.Errors. Valid documents are read exactly as before.Tests
Added
BindingInvalidScalars_Should(8 cases, one per field). All 8 fail onvnextand pass with this change; the full suite passes on net8.0/net9.0/net10.0.🤖 Generated with Claude Code