Giter Site home page Giter Site logo

Comments (3)

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

The eve.io.mongo.Validator class uses the flaskapp application context to validate the unique constraint (needs access to the MongoDB instance, something that can't be done on the client). It will probably work when/if you don't have unique in your schema, or if it is set to False. As a workaround you might want to use your own Cerberus instance, or even better a eve.io.mongo.Validator subclass which would ignore the unique constraint, but still honor ObjectId validation. For further reference check this code.

I guess you'd want to do something like that to avoid sending stuff over the wire, and save on server resources.

from eve.

LarryEitel avatar LarryEitel commented on July 23, 2024

It occurs to me that it would seem possible to wire up a Validator class like ValidatorDb where you pass in an app or db instance. That way to you pipe data directly into db using same validation logic. Then you can more easily write management scripts, etc. What do you think?

from eve.

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

You know, I think I totally misunderstood your context. At first I thought you were attempting to validate from the client while (obviously) you're talking about server side validation.

Are you passing the custom validator as an argument at startup, such as in:

app = Eve(validator=MyValidator)

from eve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.