tdegrunt/jsonschema

alpha-numeric format not working

conde2 opened this issue · 2 comments

Hello I just noticed that the alpha-numeric format is not working, here is an example:
I want to add multiple formats thats why I'm using allOf,

I'm using Typescript 4.3
Node 14.15.4

var validator = new Validator();
console.log(validator.validate('Hi2-**,', {
    type: 'string',
    allOf: [
        {
            format: 'alpha-numeric',
        }
    ]

}).valid);

It should log false, but it is returning true

I just notice that it should be alphanumeric instead of alpha-numeric

I think would be good to update the examples/all.js

// alpha-numeric, utc-millisec

Another documentation error I found is that

var res = validate(undefined, {type: 'string'}, {required: true});

But my compiler complains, because it is not specified in Options interface

Argument of type '{ required: boolean; }' is not assignable to parameter of type 'Options'.
  Object literal may only specify known properties, and 'required' does not exist in type 'Options'.ts(2345)