Comments (5)
Right now you can use this from readme:
var validator = new zSchema();
validator.compileSchema(schema, function (err, compiledSchema) {
assert.isUndefined(err);
...
});
Compilation includes also a schema validation.
But good idea, I'll expose sync schema validation in 1.5.x when I get to it.
from z-schema.
@jokeyrhyme I've pushed an update ... this is something you can use? it's not on npm yet
it('should validate schema sync', function (done) {
var sch = {
"type": "string"
};
var ins = new zSchema();
var report = ins.validateSchema(sch);
assert.isTrue(report.valid);
done();
});
it('should not validate schema sync', function (done) {
var sch = {
"type": null
};
var ins = new zSchema();
var report = ins.validateSchema(sch);
assert.isFalse(report.valid);
done();
});
from z-schema.
Looks good. It would allow for validation of a schema without necessarily involving the rest of the compilation sequence. :)
from z-schema.
Cool, I'll get in on the npm later with updated readme.
from z-schema.
Done, let me know if you have any more problems or feature requests :) ab3e146
from z-schema.
Related Issues (20)
- add keyword in error objects of getLastErrors()
- Allow to specify errors to be reported
- why when schema type is string, there is no error when the value type is integer or number ? HOT 2
- Update to core-js 3.x
- Doesn't validate minimum and maximum on numbers HOT 1
- Versions mismatch cause npm error HOT 4
- Remove core-js HOT 2
- Missing type for Validator.validate(json, schema, options) HOT 3
- 'email' format accepts email addresses with several types of whitespace. HOT 3
- 'ARRAY_ADDITIONAL_ITEMS' error unreachable?
- Is there any approach to suppress an error code HOT 2
- Local schemas not being retrieved from cache
- zSchema doesn't support json-schema post 2020-12
- Vulnerabilities introduced by package validator HOT 2
- Vulnerability in Validator JS HOT 1
- Update Validator to 13.7.0 HOT 1
- `lastReport` absent in `index.d.ts` HOT 2
- Update commander as it's version marked as EOL
- Support for Unicode Properties
- List on json-schema.org HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from z-schema.