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

Support list responses #16

Open
pgjones opened this issue Sep 6, 2022 · 1 comment
Open

Support list responses #16

pgjones opened this issue Sep 6, 2022 · 1 comment

Comments

@pgjones
Copy link
Owner

pgjones commented Sep 6, 2022

How to indicate and type hint this?

@validate_response(list[Model]) ??

@maxyz
Copy link

maxyz commented Apr 28, 2023

You can have something like:

@dataclass
class Models:
    __root__: list[Model]

That way the schema is shown fine, but you'll need to change the way the reply is handled. (PydanticModel.asdict will be a dict including root, while PydanticModel.json produces a nicer the list result)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants