json-schema-migrate
Advanced tools
Comparing version 0.0.1 to 0.1.0
{ | ||
"name": "json-schema-migrate", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Migrate JSON-Schema to draft-06", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"eslint": "eslint lib spec", | ||
"test-spec": "mocha spec/*.spec.js -R spec", | ||
"test-debug": "mocha spec/*.spec.js --debug-brk -R spec", | ||
"test": "nyc npm run test-spec" | ||
}, | ||
@@ -23,3 +26,23 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/epoberezkin/json-schema-migrate#readme" | ||
"homepage": "https://github.com/epoberezkin/json-schema-migrate#readme", | ||
"dependencies": { | ||
"ajv": "^5.0.4-beta.2" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.12.0", | ||
"eslint": "^3.18.0", | ||
"mocha": "^3.2.0", | ||
"nyc": "^10.1.2", | ||
"pre-commit": "^1.2.2" | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"**/spec/**", | ||
"node_modules" | ||
], | ||
"reporter": [ | ||
"lcov", | ||
"text-summary" | ||
] | ||
} | ||
} |
# json-schema-migrate | ||
Migrate JSON-Schema to draft-06 | ||
[![Build Status](https://travis-ci.org/epoberezkin/json-schema-migrate.svg?branch=master)](https://travis-ci.org/epoberezkin/json-schema-migrate) | ||
[![npm version](https://badge.fury.io/js/json-schema-migrate.svg)](http://badge.fury.io/js/json-schema-migrate) | ||
[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/json-schema-migrate/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-migrate?branch=master) | ||
## Purpose | ||
This package allows to migrate JSON-schemas to draft-06 specification. | ||
It supports: | ||
- draft-04 schemas | ||
- draft-04 hyper-schemas | ||
- [Ajv](https://github.com/epoberezkin/ajv) v5 schemas (special extended mode in Ajv 4.x.x, deprecated from version 5.0.0). | ||
## Install | ||
``` | ||
npm install json-schema-migrate | ||
``` | ||
## Usage | ||
```javascript | ||
var migrate = require('json-schema-migrate'); | ||
var schema = { | ||
id: 'my-schema', | ||
minimum: 1, | ||
exclusiveMinimum: true | ||
}; | ||
migrate.draft6(schema /*, options */); | ||
console.log(schema); | ||
// { | ||
// $id: 'my-schema', | ||
// exclusiveMinimum: 1 | ||
// } | ||
``` | ||
## Changes in schemas after migration | ||
- `id` is replaced with `$id` | ||
- `$schema` value becomes draft-06 meta-schema (or draft-06 hyper-schema) | ||
- boolean form of `exclusiveMaximum/Minimum` is replaced with numeric form | ||
- `enum` with a single allowed value is replaced with `const` | ||
- Ajv v5 `constant` is replaced with `const` | ||
- empty schema is replaced with `true` | ||
- schema `{"not":{}}` is replaced with `false` | ||
## Options | ||
- _v5_ - use v5 by default (if `$schema` keyword is absent) | ||
- _validateSchema_ - pass `false` to skip schema validation | ||
## License | ||
[MIT](https://github.com/epoberezkin/json-schema-migrate/blob/master/LICENSE) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
20343
17
544
1
66
1
5
2
+ Addedajv@^5.0.4-beta.2
+ Addedajv@5.5.2(transitive)
+ Addedco@4.6.0(transitive)
+ Addedfast-deep-equal@1.1.0(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedjson-schema-traverse@0.3.1(transitive)