Skip to content

fix: report invalid MQTT and ROS2 binding scalars as errors - #48

Merged
VisualBean merged 1 commit into
ByteBardOrg:vnextfrom
bielu:fix/binding-invalid-scalar-diagnostics
Oct 17, 2026
Merged

VisualBean merged 1 commit into
ByteBardOrg:vnextfrom
bielu:fix/binding-invalid-scalar-diagnostics

Conversation

@bielu

@bielu bielu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Some MQTT and ROS2 binding fields silently drop values that don't parse:

bindings:
  mqtt:
    cleanSession: yes-please
    keepAlive: abc

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 return null when parsing fails. Every other binding (IBM MQ, JMS, Kafka, Solace, ...) uses GetIntegerValue() / GetBooleanValue(), which throw an AsyncApiReaderException that the field parser records as a diagnostic.

Change

Switched to the reporting variants for:

Binding Fields
MQTT server cleanSession, keepAlive, lastWill.qos
MQTT message payloadFormatIndicator
ROS2 server domainId
ROS2 QoS policies lifespan, deadline, leaseDuration

Invalid values now produce Value could not parse to integer. / Value could not parse to bool. in diagnostic.Errors. Valid documents are read exactly as before.

Tests

Added BindingInvalidScalars_Should (8 cases, one per field). All 8 fail on vnext and pass with this change; the full suite passes on net8.0/net9.0/net10.0.

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2a9b1d37-c36c-4ac5-9ca7-6da050296d3a
📥 Commits

Reviewing files that changed from the base of the PR and between eb68984 and 86c9e34.

📒 Files selected for processing: 5
  • src/ByteBard.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs
  • src/ByteBard.AsyncAPI.Bindings/MQTT/MQTTServerBinding.cs
  • src/ByteBard.AsyncAPI.Bindings/ROS2/ROS2QosPolicies.cs
  • src/ByteBard.AsyncAPI.Bindings/ROS2/ROS2ServerBinding.cs
  • test/ByteBard.AsyncAPI.Tests/Bindings/BindingInvalidScalars_Should.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bielu

bielu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

@VisualBean i drafted it as didnt even had change to test it properly😂 but wanted make you aware of issue

@bielu
bielu marked this pull request as ready for review October 17, 2026 17:33
@VisualBean

VisualBean commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@VisualBean i drafted it as didnt even had change to test it properly😂 but wanted make you aware of issue

APPROVED! 😂
Honestly i just read the fix and it lgtm 😅.

I think coderabbit flagged it as well, but I was pretty sure that the last call down the stack took care of it.
So since you are flagging it as Well 😅

@bielu

bielu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Yeah i was reviewing your changes, as i mention it in docs for my package as well:
https://apidescriptions.bielu.pl/articles/protocols-broker-bindings.html
and it come as slight comment from claude so i address it as it was pickup by my scan for changes and issues :D

@VisualBean
VisualBean merged commit a13c612 into ByteBardOrg:vnext Oct 17, 2026
9 checks passed
@VisualBean

Copy link
Copy Markdown
Contributor

Yeah i was reviewing your changes, as i mention it in docs for my package as well:

https://apidescriptions.bielu.pl/articles/protocols-broker-bindings.html

and it come as slight comment from claude so i address it as it was pickup by my scan for changes and issues :D

Thanks for recent batch.
Will get a new beta release out tonight 👍

@bielu

bielu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

I am checking few more things so you might wait few more minutes 😂

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.

2 participants