Package Exports
- json-schema-migrate
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-schema-migrate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
json-schema-migrate
Migrate JSON-Schema to draft-06
Purpose
This package allows to migrate JSON-schemas to draft-06 specification.
It supports:
- draft-04 schemas
- draft-04 hyper-schemas
- Ajv v5 schemas (special extended mode in Ajv 4.x.x, deprecated from version 5.0.0).
Install
npm install json-schema-migrate
Usage
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 withconst
- Ajv v5
constant
is replaced withconst
- empty schema is replaced with
true
- schema
{"not":{}}
is replaced withfalse
Options
- v5 - use v5 by default (if
$schema
keyword is absent) - validateSchema - pass
false
to skip schema validation