Giter VIP home page Giter VIP logo

Comments (5)

drewlsvern avatar drewlsvern commented on August 14, 2024 2

I have tried implementing exactly as shown here, but it doesn't seem to work. It just displays the default regEx error message "[label] failed regular expression validation". Are there any known bugs with feature?

from meteor-simple-schema.

mquandalle avatar mquandalle commented on August 14, 2024

Then what is the rule to check if an object match the SimpleSchema? Does it have to match all the regex? Are some of them optional (@sbking suggested this for a warning use case)?

from meteor-simple-schema.

aldeed avatar aldeed commented on August 14, 2024

Yes, it would have to match all regex. As I've commented in the other issue, there is no reason for SS to need to worry about the concept of warnings. The goal is just to define strict rules for our object/database.

from meteor-simple-schema.

sbking avatar sbking commented on August 14, 2024

Yep, with multiple schemas for multiple validation states, this implementation makes sense. It would be nice if the the regex rules were validated in the order that they are defined, which should still work with an object instead of an array.

from meteor-simple-schema.

aldeed avatar aldeed commented on August 14, 2024

Went with an array because of @sbking's comment about validation order. Object key order isn't 100% reliable as spec'd. You can still customize messages based on array index:

MySchema = new SimpleSchema({
  password: {
    type: String,
    regEx: [twoNumbersRegEx, twoSpecialCharactersRegEx]
  }
});

MySchema.messages({
    'regEx.0': "[label] must have two numbers"
});

from meteor-simple-schema.

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.