Giter VIP home page Giter VIP logo

jassi's People

Contributors

iclanzan avatar lobodpav avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

jassi's Issues

Support for own error messages

Would be great to be able to specify custom error message for each property constraint so that jassi would use it as message instead of the default text.

This is handy when developing REST services and want to use custom messages being returned to the caller.

Jassi ignores "maxLength:0" contrary to specification.

https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1 states

5.2.1. maxLength

5.2.1.1. Valid values

The value of this keyword MUST be an integer. This integer MUST be
greater than, or equal to, 0.

Test case:

// Jassi ignores "maxLength:0"
let schema = {
      "oneOf":[
         {
            "type":"string",
            "format":"email",
            "minLength":1
         },
         {
            "type":"string",
            "maxLength":0
         }
      ]
   } ;

let schemaShort = {
   "type":"string",
   "maxLength":0
} ;

// Local test.
let errors = jassi ( "[email protected]" , schemaShort ) ;
console . log ( errors ) ;
let errors2 = jassi ( "[email protected]" , schema ) ; // Should be valid and is not.
console . log ( errors ) ;

Missing property name for required fields

Hi,

I'm running some testes locally and I can see that the property value is empty for required fields, and I'm wondering why.

thanks!

[
 { property: '',
    message: 'Required property "firstName" is missing.' },
  { property: '',
    message: 'Required property "lastName" is missing.' },
  { property: 'age',
    message: 'The instance must have a minimum value of 10.' }
 ]

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.