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

How to use pydantic model in @extend_schema with "many=True" #1232

Open
microHoffman opened this issue May 9, 2024 · 1 comment
Open

How to use pydantic model in @extend_schema with "many=True" #1232

microHoffman opened this issue May 9, 2024 · 1 comment

Comments

@microHoffman
Copy link

Hello!
I have pydantic v2 model and I'd like to annotate my view using @extend_schema(response=...) that it returns the list of this pydantic model instances, something similar as you can do with DRF serializer using many=True... however I did not find a way how I can make this work correctly...
Can you please help me what is a way of doing so? I've tried TypeAdapter, List[MyModel] and some other combinations, but neither of them seems to return correct openapi schema with correctly defined refs in #/components/schemas/{model}...
Thanks a lot!

@ignis-tech-solutions
Copy link

Did you find any solution for this @microHoffman?

cc: @tfranzel if you can help please

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