Skip to content
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

Bug: Incorrect payload in generated AsyncAPI if using parent class in dependency injection #2040

Open
HelgeKrueger opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@HelgeKrueger
Copy link

Describe the bug

Generated AsyncAPI example and payload is incorrect if dependency on parent class is used. See example below on what I mean, the function info depends on something of type One, but my subscriber requires Two. However, the generated AsyncAPI claims the subscriber takes One as argument.

How to reproduce
Include source code:

from pydantic import BaseModel

from faststream import FastStream, Depends
from faststream.rabbit import RabbitBroker


class One(BaseModel):
    one: str


class Two(One):
    two: str


def info(msg: One):
    return msg.one


broker = RabbitBroker()


@broker.subscriber("three")
async def three(msg: Two, one=Depends(info)): ...


app = FastStream(broker)

Now run faststream docs serve app:app, and the included example is

{
  "one": "string"
}

Screenshot 2025-01-15 at 20-48-08 FastStream AsyncAPI

@HelgeKrueger HelgeKrueger added the bug Something isn't working label Jan 15, 2025
@HelgeKrueger HelgeKrueger changed the title Bug: Bug: Incorrect payload in generated AsyncAPI if using parent class in dependency injection Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant