Describe the bug
With AsyncAPI 3.0, when registering multiple handlers on the same publishers with some of the return types having nested Pydantic models inside them, these nested models are not defined correctly in the AsyncAPI spec resulting in an invalid state (the model referenced does not exist)
How to reproduce
Include source code:
class User(pydantic.BaseModel):
class Email(pydantic.BaseModel):
email: str
email: Email
name: str = ""
id: int
broker = self.broker_class()
publisher = broker.publisher("test")
@publisher
def handle0(msg) -> User:
...
class Other(pydantic.BaseModel):
id: int
@publisher
def handle1(msg) -> Other:
...
schema = self.get_spec(broker).to_jsonable()
payload = schema["components"]["schemas"]
assert "User" in payload
assert "Other" in payload
assert "Email" in payload # <-- Assert fails
Expected behavior
The AsyncAPI schema should be valid.
Environment
main branch / 0.6.0rc0
Additional context
I will try to find a workaround/bugfix for now
Describe the bug
With AsyncAPI 3.0, when registering multiple handlers on the same publishers with some of the return types having nested Pydantic models inside them, these nested models are not defined correctly in the AsyncAPI spec resulting in an invalid state (the model referenced does not exist)
How to reproduce
Include source code:
Expected behavior
The AsyncAPI schema should be valid.
Environment
main branch / 0.6.0rc0
Additional context
I will try to find a workaround/bugfix for now