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

Propagate nullability in ModelSerializer #8116

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Aug 6, 2021

Description

Propagate the nullability of underlying model fields in ModelSerializer
when those fields are marked as read only. This ensures the correct
generation of OpenAPI schemas.

Closes #8041.

cc @canassa @kevin-brown

Propagate the nullability of underlying model fields in ModelSerializer
when those fields are marked as read only. This ensures the correct
generation of OpenAPI schemas.

Fix encode#8041.
@tomchristie
Copy link
Member

Great, thanks!

@tomchristie tomchristie merged commit b215375 into encode:master Aug 6, 2021
@benesch benesch deleted the nullable-read-only branch August 6, 2021 13:48
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
Propagate the nullability of underlying model fields in ModelSerializer
when those fields are marked as read only. This ensures the correct
generation of OpenAPI schemas.

Fix encode#8041.
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 this pull request may close these issues.

null=True is not respected by AutoSchema when the field is on read_only_fields
2 participants