iclanzan / jassi Goto Github PK
View Code? Open in Web Editor NEWJavaScript JSON Schema Validator
License: Other
JavaScript JSON Schema Validator
License: Other
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.
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 ) ;
I've compiled a report of the failing tests here:
https://github.com/Muscula/json-schema-benchmark/blob/master/reports/jassi.md
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.' }
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.