Skip to content

Enforce allow_empty=False during partial validation of parent serializer #6512

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

Conversation

reupen
Copy link
Contributor

@reupen reupen commented Mar 17, 2019

Description

Refs #6509

This enforces allow_empty=True when a ListSerializer is a child of another serializer and partial validation is being performed on the parent serializer.

This is because partial validation should allow fields to be omitted, but should not cause values that are invalid without partial validation to become valid.

This effectively reverts #4222. None of the tests added in that PR fail if the associated change is removed, so I‘m not sure what that PR was trying to fix.

@reupen reupen marked this pull request as ready for review March 17, 2019 17:25
@kevin-brown
Copy link
Member

It looks like this was added in #4222 and there were tests that accompanied it. My guess is that in the time since this was implemented, we covered those test cases from another angle.

@reupen
Copy link
Contributor Author

reupen commented Apr 4, 2019

By 'none of the tests added in that PR fail if the associated change is removed', I meant that if I check out c752e96 and remove the changes to serializers.py, the tests still pass for me.

Copy link
Member

@kevin-brown kevin-brown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to give this the approval because 1) tests pass without additional changes 2) it removes an extra special case that we have

Refs encode#6509

This enforces allow_empty=True when a ListSerializer is a child of another serializer and partial validation is being performed on the parent serializer.

This is because partial validation should allow fields to be omitted, but should not cause values that are invalid without partial validation to become valid.

This effectively reverts encode#4222. None of the tests added in that PR fail if the associated change is removed, so I‘m not sure what that PR was trying to fix.
@reupen reupen force-pushed the issue-6509-list-allow-empty-partial-validation branch from e35fee9 to ec7f7d0 Compare May 2, 2019 20:01
@reupen
Copy link
Contributor Author

reupen commented May 2, 2019

Thanks. I have rebased the PR.

Copy link
Member

@rpkilby rpkilby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍looks good to me. Good use of parameterization without overcomplicating the test cases.

@rpkilby rpkilby added this to the 3.10 Release milestone May 3, 2019
@tomchristie
Copy link
Member

👍

@tomchristie tomchristie merged commit 3242adf into encode:master Jul 1, 2019
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
…zer (encode#6512)

Refs encode#6509

This enforces allow_empty=True when a ListSerializer is a child of another serializer and partial validation is being performed on the parent serializer.

This is because partial validation should allow fields to be omitted, but should not cause values that are invalid without partial validation to become valid.

This effectively reverts encode#4222. None of the tests added in that PR fail if the associated change is removed, so I‘m not sure what that PR was trying to fix.
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
…zer (encode#6512)

Refs encode#6509

This enforces allow_empty=True when a ListSerializer is a child of another serializer and partial validation is being performed on the parent serializer.

This is because partial validation should allow fields to be omitted, but should not cause values that are invalid without partial validation to become valid.

This effectively reverts encode#4222. None of the tests added in that PR fail if the associated change is removed, so I‘m not sure what that PR was trying to fix.
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.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy