You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my company project we use extensively Annotated Discriminated Unions both for inputs and outputs schemas
We recentlty encountered wrongly assigned schemas in openapi doc, as we added a paginated endpoint
This code will result in wrongly assigned Paged schemas in openapi doc
I believe this is caused by make_response_paginated and more precisely by the type creation being made with new_name = f"Paged{item_schema.__name__}" resulting in new_name = PagedAnnotated which is always the same name for Annotated schemas
As it's the same name, it probably overwrites previous schemas of same name in schemas registry
Versions (please complete the following information):
Python version: 3.12.4
Django version: 5.0.9
Django-Ninja version: 1.3.0
Pydantic version: 2.9.2
This is kind of problematic for us as our frontend team generates TS client types validation from the OpenAPI schemas
The text was updated successfully, but these errors were encountered:
M3te0r
changed the title
[BUG] Paginated Discriminated Annotated Unions response schemas are overridden by make_response_paginated
[BUG] Paginated Discriminated Annotated Unions response schemas are overridden in OpenAPI docs by make_response_paginated
Oct 2, 2024
Describe the bug
Hi,
In my company project we use extensively Annotated Discriminated Unions both for inputs and outputs schemas
We recentlty encountered wrongly assigned schemas in openapi doc, as we added a paginated endpoint
Here is a minimal reproductible api code:
This code will result in wrongly assigned Paged schemas in openapi doc
I believe this is caused by
make_response_paginated
and more precisely by the type creation being made withnew_name = f"Paged{item_schema.__name__}"
resulting innew_name = PagedAnnotated
which is always the same name for Annotated schemasAs it's the same name, it probably overwrites previous schemas of same name in schemas registry
Versions (please complete the following information):
This is kind of problematic for us as our frontend team generates TS client types validation from the OpenAPI schemas
The text was updated successfully, but these errors were encountered: