django-ninja
django-ninja copied to clipboard
[BUG] `ModelSchema` produces `id > (integer | null)` openapi
Describe the bug
Having this model definition:
class MyModel(ModelSchema):
class Meta:
model = MyModel
fields = ["id"]
Produces next definition on Swagger: id > (integer | null).
However this definition:
class MyModel(ModelSchema):
id: int
class Meta:
model = MyModel
Produces id* integer as expected. SQL is default — id bigint NOT NULL
Versions (please complete the following information):
- Python version: 3.12.2
- Django version: 5.0.2
- Django-Ninja version: 1.1.0
- Pydantic version: 2.6.4
Probably a duplicate of https://github.com/vitalik/django-ninja/issues/907
What does your MyModel orm model look like?