You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The python code generated from the generator example (https://www.asyncapi.com/tools/generator) has several issues that prevent the code from running (without debugging):
messaging.py:13 sets defaultHost to 'test.mosquitto.org:{port}'. This is invalid in 3 ways. 1: that's not a functional string template 2: the host should not have the port (port is declared independently on L35) 3: if the string template were functional, we would get an error due to using 'port' before it is declared. - To resolve all of this we change the string to 'test.mosquitto.org'
messaging.py:36 uses port 1833 as the hardcoded fallback. This should be port 1883.
main.py:47 "smartylightingStreetlights10ActionStreetlightIdTurnOnMessenger" is not declared. This should be "smartylightingStreetlights10EventStreetlightIdLightingMeasuredMessenger".
Other remarks:
messaging.py:11 - declaring on_connect as a global is not required as the function is in the same module/file.
messaging.py:20 - I don't think self.client.enable_logger() is doing anything as the script is totally silent when it runs normally.
How to Reproduce
Using Python 3.11 (though the issues would apply to all Python 3 versions equally).
Go to https://www.asyncapi.com/tools/generator and switch generator to Python Paho.
Run code block provided.
For the purposes of brevity I will skip creation and activation of a virtual environment.
Install paho with pip install paho-mqtt.
(Note: I am not considering it a bug that there is no requirements file generated as that may be out of scope.)
On line 42 of main, we are instructed to add arguments. So we will change the line to: payload = TurnOnOffPayload(TurnOnOffPayload.Command("on"), "1999-12-31T23:59:59.999Z")
This should work, per the instructions. However, we will encounter several issues, detailed in the "Describe the bug" section.
Expected behavior
Setting the required arguments should be the only modifications required to make the example functional.
The text was updated successfully, but these errors were encountered:
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. Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
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. Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Describe the bug
The python code generated from the generator example (https://www.asyncapi.com/tools/generator) has several issues that prevent the code from running (without debugging):
'test.mosquitto.org:{port}'
. This is invalid in 3 ways. 1: that's not a functional string template 2: the host should not have the port (port is declared independently on L35) 3: if the string template were functional, we would get an error due to using 'port' before it is declared. - To resolve all of this we change the string to 'test.mosquitto.org'Other remarks:
messaging.py:11 - declaring on_connect as a global is not required as the function is in the same module/file.
messaging.py:20 - I don't think
self.client.enable_logger()
is doing anything as the script is totally silent when it runs normally.How to Reproduce
Using Python 3.11 (though the issues would apply to all Python 3 versions equally).
Go to https://www.asyncapi.com/tools/generator and switch generator to Python Paho.
Run code block provided.
For the purposes of brevity I will skip creation and activation of a virtual environment.
Install paho with
pip install paho-mqtt
.(Note: I am not considering it a bug that there is no requirements file generated as that may be out of scope.)
On line 42 of main, we are instructed to add arguments. So we will change the line to:
payload = TurnOnOffPayload(TurnOnOffPayload.Command("on"), "1999-12-31T23:59:59.999Z")
This should work, per the instructions. However, we will encounter several issues, detailed in the "Describe the bug" section.
Expected behavior
Setting the required arguments should be the only modifications required to make the example functional.
The text was updated successfully, but these errors were encountered: