-
Notifications
You must be signed in to change notification settings - Fork 34
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
Validator support #21
Comments
Unfortunately it looks like it'd be quite hard work to make the |
Triggering class Article(Base):
content = Column(NestedMutableJson(validate_on_change=True)) This could then be used to generate the relevant |
I've been experimenting with simply making
Which makes it possible to replace those with variants that have had a mixin applied to them. It works but it's complicated slightly by the decision to overload |
The After some cursory investigation though, I can't see how to get from the mutable wrapper class to the actual column property, to issue the validation. Do you have a code example for that, assuming you've got it to work? Adding some points where delegates classes can be overridden sounds reasonable regardless, but handling the whole case with a single flag might be nice. That said, my suggested solution above puts settings for the mutable delegation in the SQL type, which is not quite ideal either (and not necessarily accessible by |
The last to get hit is actually the The thing that actually foils me is the way I am partly working off an old patch set that I worked on to solve this problem a few years ago (and it worked well, but let's not go into why the PR was not applied) https://github.com/alphagov/digitalmarketplace-api/pull/412/files |
Hi,
Another weakness in sqlalchemy's mutable object support is the fact that
@validates
validators aren't run when nested objects are mutated, meaning changes can bypass validation - far from ideal. It would be nice if your library also made an attempt at fixing this, making it more of a "complete solution".One potential pitfall I guess could be issues with expensive validation functions causing poor performance.
The text was updated successfully, but these errors were encountered: