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

[BUG] ModelSchema does not mark field as required if it has a default value #1137

Open
nofalx opened this issue Apr 24, 2024 · 0 comments · May be fixed by #1139
Open

[BUG] ModelSchema does not mark field as required if it has a default value #1137

nofalx opened this issue Apr 24, 2024 · 0 comments · May be fixed by #1139

Comments

@nofalx
Copy link
Contributor

nofalx commented Apr 24, 2024

Describe the bug
A clear and concise description of what the bug is.

Versions (please complete the following information):

  • Python version: 3.11
  • Django version: 5.0.4
  • Django-Ninja version: 1.1.0
  • Pydantic version: 2.7.1

The issue:

Using the class ModelSchema does not mark the model field as required if it has a default value. When removing the default value from the model the field is marked correctly as required. Below are sample of the Django Model and ModelScema used. The generated schema in redoc shows it as not required.

image
image
image

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

Successfully merging a pull request may close this issue.

1 participant