@jsonresume/schema
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "@jsonresume/schema", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "JSON Resume Schema", | ||
@@ -30,3 +30,3 @@ "private": false, | ||
"dependencies": { | ||
"z-schema": "^4.2.4" | ||
"jsonschema": "^1.4.1" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
@@ -18,6 +18,8 @@ # JSON Resume Schema | ||
This enforces that the schema package, always has the official stable release of the schema. | ||
### Getting started | ||
``` | ||
npm install --save resume-schema | ||
npm install --save @jsonresume/schema | ||
``` | ||
@@ -28,3 +30,3 @@ | ||
```js | ||
const resumeSchema = require("resume-schema"); | ||
const resumeSchema = require("@jsonresume/schema"); | ||
resumeSchema.validate( | ||
@@ -31,0 +33,0 @@ { name: "Thomas" }, |
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"additionalProperties": false, | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
" $id": "http://example.com/example.json", | ||
"additionalProperties": true, | ||
"definitions": { | ||
"iso8601": { | ||
"type": "string", | ||
"description": "e.g. 2014-06-29", | ||
"description": "Similar to the standard date type, but each section after the year is optional. e.g. 2014-06-29 or 2023-04", | ||
"pattern": "^([1-2][0-9]{3}-[0-1][0-9]-[0-3][0-9]|[1-2][0-9]{3}-[0-1][0-9]|[1-2][0-9]{3})$" | ||
@@ -277,5 +278,3 @@ } | ||
"date": { | ||
"type": "string", | ||
"description": "e.g. 1989-06-12", | ||
"format": "date" | ||
"$ref": "#/definitions/iso8601" | ||
}, | ||
@@ -282,0 +281,0 @@ "url": { |
@@ -1,15 +0,15 @@ | ||
'use strict'; | ||
var ZSchema = require('z-schema'); | ||
var schema = require('./schema'); | ||
"use strict"; | ||
var schema = require("./schema"); | ||
var Validator = require("jsonschema").Validator; | ||
function validate(resumeJson, callback) { | ||
var callbackWrapper = function(err, valid) { | ||
if(err) { | ||
callback(err) | ||
} else { | ||
callback(null, {valid: valid}); | ||
} | ||
var v = new Validator(); | ||
const validation = v.validate(resumeJson, schema); | ||
if (!validation.valid) { | ||
return callback(validation.errors, false); | ||
} | ||
new ZSchema().validate(resumeJson, schema, callbackWrapper); | ||
return callback(null, true); | ||
} | ||
@@ -19,3 +19,3 @@ | ||
validate: validate, | ||
schema: schema | ||
schema: schema, | ||
}; |
31712
94
871
+ Addedjsonschema@^1.4.1
+ Addedjsonschema@1.5.0(transitive)
- Removedz-schema@^4.2.4
- Removedcommander@2.20.3(transitive)
- Removedlodash.get@4.4.2(transitive)
- Removedlodash.isequal@4.5.0(transitive)
- Removedvalidator@13.12.0(transitive)
- Removedz-schema@4.2.4(transitive)