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
Describe the bug
When two inner classes with the same name are used in different classes to define the field type, only the last one is generated in openapi.json and all refs are pointing to it.
Versions:
Python version: 3.11.4
Django version: 4.2.5
Django-Ninja version: 0.22.2
Pydantic version: 1.10.12
Context
I was trying to achieve a result schema with a single value that represents a type of response to be able to parse it in a typescript client properly. I know that in open API spec is something like Discriminator but I don't know how to tell Ninja to generate it pointing to the chosen property name.
@ostatni5 just a side note - seems pydantic2 will not allow you making nested classes.. so basically this approach is not recommended if you intend to upgarde to future versions of django ninja
Describe the bug
When two inner classes with the same name are used in different classes to define the field type, only the last one is generated in
openapi.json
and all refs are pointing to it.Versions:
Context
I was trying to achieve a result schema with a single value that represents a type of response to be able to parse it in a typescript client properly. I know that in open API spec is something like
Discriminator
but I don't know how to tell Ninja to generate it pointing to the chosen property name.Code
Sample schema definition:
Schemas in
openapi.json
Probably prefixes made from the outer classes could fix this issue.
The text was updated successfully, but these errors were encountered: