From 87eea0f46e8a95e1f23f4e3e2c7642ee2a3ee765 Mon Sep 17 00:00:00 2001 From: Yaroslav Petrov Date: Wed, 1 Jan 2025 19:01:02 +0000 Subject: [PATCH] Fix template error that caused publish/request confusion --- pyproject.toml | 2 +- .../generators/amqp/templates/application.py.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 19d82f0..d0fd3e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "asyncapi-python" -version = "0.1.5" +version = "0.1.6" license = "Apache-2.0" description = "Easily generate type-safe and async Python applications from AsyncAPI 3 specifications." authors = ["Yaroslav Petrov "] diff --git a/src/asyncapi_python_codegen/generators/amqp/templates/application.py.j2 b/src/asyncapi_python_codegen/generators/amqp/templates/application.py.j2 index e509342..ed03456 100644 --- a/src/asyncapi_python_codegen/generators/amqp/templates/application.py.j2 +++ b/src/asyncapi_python_codegen/generators/amqp/templates/application.py.j2 @@ -36,7 +36,7 @@ class Application(BaseApplication): {% for op in ops if op.action == "send" -%} {%- set in_type = "Union[" + (op.input_types | join(", ")) + "]" -%} - {%- set out_type = "Union[" + (op.output_types | join(", ") if op.output_types else "None") + "]" -%} + {%- set out_type = ("Union[" + op.output_types | join(", ") + "]") if op.output_types else "None" -%} {%- set callback_type = "Callable[["+ in_type + "], Awaitable[" + out_type + "]" + "]" -%} {%- set send_method = "publish" if out_type == "None" else "request" -%} {%- set routing_key_literal = '"' + op.routing_key + '"' if op.routing_key else "None" -%}