-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
How to describe MQTT v5 user properties in an AsyncAPI document? #878
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
It should go into the MQTT5 binding. However, nobody has defined it yet. We do have the MQTT binding that's meant for versions prior to 5. Maybe you want to help contribute to the MQTT5 binding? Seems to me that it should go into the Server binding specifically. |
@fmvilas what is the difference in MQTT5 message properties and generic message header? By the way since #158 seems to say generic header are a valid representation of key pair values, I guess the same goes for MQTT5. Does it make sense? |
The difference is in the AsyncAPI specification. Message headers should contain application-specific stuff only and should leave protocol-specific stuff out. Everything that's related to a specific protocol, should go into a binding. Sure, you can put it in a header and that might work but we're trying to maintain a clear separation between the two.
See https://www.asyncapi.com/docs/reference/specification/v2.5.0#messageObject. Think about it this way: you should be able to use the same message definition with two different protocols. If you put protocol-specific stuff in the In MQTT5, AFAIK, User Properties are for defining application-specific stuff so yeah, it should go on message headers when it makes sense. In my comment above, I thought these User Property fields were only present in the |
Crystal clear, thank you @fmvilas for the extensive answer. |
Hi,
Our product has an asynchronous API in MQTT v5 protocol.
In this API, we have designed messages using MQTT v5 user properties.
We have described this API using an AsyncAPI v2.5.0 document.
Here is an minimalist example of how we have tried to describe these MQTT v5 user properties :
When we use keyword “headers”, AsyncAPI studio requires the use of the “type” keyword with value “object” :
According to MQTT v5 specification, user property is defined like following :
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901054
What is the correct way to describe MQTT v5 user properties in an AsyncAPI document ?
Thank you
The text was updated successfully, but these errors were encountered: