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

When an object is already created, and is not replacing, skip all required fields that were not modified. #347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bernie
Copy link

@Bernie Bernie commented Apr 17, 2021

This fixes the issue reported in #346

Copy link
Collaborator

@lafrech lafrech left a comment

Choose a reason for hiding this comment

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

Thanks. I agree on the cause.

Would it be a better implementation if we did this?

class EmbeddedDocument:
    def required_validate(self):
        self._data.required_validate(partial=self.is_created)

class DataProxy:
    def required_validate(self, partial):
        [...]
        if partial and name not in self.get_modified_fields():
            [...]

This avoids accessing _data.get_modified_fields from upper layers.

No need to even modify each driver.

Or maybe

class EmbeddedDocument:
    def required_validate(self, update=False):
        self._data.required_validate(update=update)

class DataProxy:
    def required_validate(self, update):
        [...]
        if update and name not in self.get_modified_fields():
            [...]

Needs to specify update explicitly in the drivers but might be better.

@Bernie
Copy link
Author

Bernie commented Apr 30, 2021 via email

@Neustradamus

This comment has been minimized.

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.

3 participants