When an object is already created, and is not replacing, skip all required fields that were not modified.#347
Open
Bernie wants to merge 1 commit into
Conversation
…uired fields that were not modified.
lafrech
reviewed
Apr 22, 2021
lafrech
left a comment
Collaborator
There was a problem hiding this comment.
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.
Author
|
I'm not as familiar with the code, so my fix may not have been as optimal.
If this can be done without having to change the API for the drivers, then
even better.
…On Thu, Apr 22, 2021 at 5:27 PM Jérôme Lafréchoux ***@***.***> wrote:
***@***.**** commented on this pull request.
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#347 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQDSGH3K2OLE4EYRH4UUTTKCIFXANCNFSM43CTDT2Q>
.
|
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the issue reported in #346