Socket
Socket
Sign inDemoInstall

json-schema-migrate

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-migrate

Migrate JSON-Schema to draft-06


Version published
Weekly downloads
238K
decreased by-12.44%
Maintainers
1
Weekly downloads
 
Created
Source

json-schema-migrate

Migrate JSON-Schema to draft-06

Build Status npm version Coverage Status

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 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

Keywords

FAQs

Package last updated on 17 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc