Open KrySeyt opened 3 months ago
Describe the bug 1) In some way you describe the message, for example:
@dataclass class Input: value: int
2) Describe the handler with this message:
@broker.subscriber("in1") async def handle_msg(a: Input) -> None: ...
3) Override your message:
@dataclass class Input: not_in_schema: str
4) Describe the handler with overrided message:
@broker.subscriber("in2") async def please_good_schema(a: Input) -> None: ...
5) Create asyncapi schema and look at #/components/schemas
#/components/schemas
"schemas": { "Input": { "properties": { "value": { "title": "Value", "type": "integer" } }, "required": [ "value" ], "title": "Input", "type": "object" } }
Where is my Input.not_in_schema: str? For example, it will be a problem if I have the same named dataclasses in different packages
Input.not_in_schema: str
How to reproduce
from dataclasses import dataclass from faststream import FastStream from faststream.rabbit import RabbitBroker broker = RabbitBroker() app = FastStream(broker) @dataclass class Input: value: int @broker.subscriber("in1") async def handle_msg(a: Input) -> None: ... @dataclass class Input: not_in_schema: str @broker.subscriber("in2") async def please_good_schema(a: Input) -> None: ...
And/Or steps to reproduce the behavior:
Expected behavior I expect two payload in schema:
value: int
not_in_schema: str
Observed behavior Message "overriding" just ignored, in the schema all handlers use only the first definition of the message
Environment Running FastStream 0.5.15 with CPython 3.12.3 on Linux
Additional context Same problem in the case of handlers + args names duplication:
@broker.subscriber("in1") async def handle_msg(a: int) -> None: ... @broker.subscriber("in2") async def handle_msg(a: str) -> None: ...
"schemas": { "HandleMsg:Message:Payload": { "title": "HandleMsg:Message:Payload", "type": "integer" } }
Warning should be good solution
Describe the bug 1) In some way you describe the message, for example:
2) Describe the handler with this message:
3) Override your message:
4) Describe the handler with overrided message:
5) Create asyncapi schema and look at
#/components/schemas
Where is my
Input.not_in_schema: str
? For example, it will be a problem if I have the same named dataclasses in different packagesHow to reproduce
And/Or steps to reproduce the behavior:
Expected behavior I expect two payload in schema:
value: int
not_in_schema: str
Observed behavior Message "overriding" just ignored, in the schema all handlers use only the first definition of the message
Environment Running FastStream 0.5.15 with CPython 3.12.3 on Linux
Additional context Same problem in the case of handlers + args names duplication: