Open
Description
Describe the bug
As a result of #1181, all primary keys are now marked as nullable in ModelSchema, regardless of whether the field is set to nullable or not. I'm not sure why this was done, but I would expect it to defer to the field's own nullable setting instead if for some reason you have a nullable primary key. If the intention was to make this optional for request schemas, I think it should be marked in fields_optional
instead in the Meta class.
This is a result of these lines here in fields.py
django-ninja/ninja/orm/fields.py
Lines 153 to 155 in 8a49992
Versions (please complete the following information):
- Python version: 3.12
- Django version: 5.0.7
- Django-Ninja version: 1.2.1
- Pydantic version: 2.8.2
Metadata
Metadata
Assignees
Labels
No labels