Skip to content

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

Merged
lovelydinosaur merged 1 commit intoencode:masterfrom
reupen:issue-6509-list-allow-empty-partial-validation
Jul 1, 2019
Merged

Enforce allow_empty=False during partial validation of parent serializer#6512
lovelydinosaur merged 1 commit intoencode:masterfrom
reupen:issue-6509-list-allow-empty-partial-validation

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
Contributor

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
Contributor

@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
Contributor

@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
@lovelydinosaur
Copy link
Contributor

👍

@lovelydinosaur lovelydinosaur 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