{"id":48262,"library":"json-schema-compatibility","title":"JSON Schema Compatibility","description":"Converts JSON Schema v3 schemas to v4 compatibility, solving the problem of migrating legacy schemas to the newer draft. Version 1.1.0 is the latest stable release; the project appears to be in maintenance mode with no recent updates. Unlike alternatives that require manual rewriting, this tool works in-place on schema objects and supports merged syntaxes like mixed boolean/array 'required'. Released under public domain and MIT licenses.","status":"maintenance","version":"1.1.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","json","json-schema","schema","compatibility"],"install":[{"cmd":"npm install json-schema-compatibility","lang":"bash","label":"npm"},{"cmd":"yarn add json-schema-compatibility","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-schema-compatibility","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS required. The module exports a function with a 'v4' method; destructuring may work but not standard.","wrong":"const { v4 } = require('json-schema-compatibility');","symbol":"v4","correct":"var api = require('json-schema-compatibility'); api.v4(schema);"},{"note":"Browser global only; no ESM support.","wrong":"import JsonSchemaCompatibility from 'json-schema-compatibility';","symbol":"JsonSchemaCompatibility","correct":"<script src=\"json-schema-compatibility.min.js\"></script> // then JsonSchemaCompatibility.v4(schema)"},{"note":"Default import works via ESM interop, but not officially supported.","wrong":"import { v4 } from 'json-schema-compatibility';","symbol":"v4 (ESM)","correct":"import jsonSchemaCompatibility from 'json-schema-compatibility'; jsonSchemaCompatibility.v4(schema);"}],"quickstart":{"code":"var api = require('json-schema-compatibility');\nvar v3Schema = {\"type\": \"number\", \"divisibleBy\": 1.5};\nvar v4Schema = api.v4(v3Schema);\nconsole.log(JSON.stringify(v4Schema));\n// Output: {\"type\":\"number\",\"multipleOf\":1.5}","lang":"javascript","description":"Shows converting a v3 schema to v4 using Node.js require and the v4 function."},"warnings":[{"fix":"Clone the schema first if you need the original: var copy = JSON.parse(JSON.stringify(original)); api.v4(copy);","message":"The tool modifies the schema object in-place; do not rely on the original object after conversion.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a more modern library (e.g., ajv with addSchema for multiple drafts) or manually update to latest draft.","message":"The package has not been updated since 2014; v4 is now outdated (JSON Schema draft-07 and later exist).","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Include an ES5 shim (e.g., es5-shim) before this library in older browsers.","message":"Browser usage requires a global shim for Array.isArray and other ES5 features.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use CommonJS require or bundler's CommonJS interop (e.g., webpack with commonjs option).","message":"The package does not support ESM imports natively; attempting import may fail.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.0':24 'altern':43 'appear':32 'boolean/array':63 'compat':3,11,78 'convert':4 'domain':68 'draft':22 'in-plac':51 'javascript':72 'json':1,5,73,75 'json-schema':74 'latest':27 'legaci':17 'licens':71 'like':61 'mainten':36 'manual':46 'merg':59 'migrat':16 'mit':70 'mix':62 'mode':37 'newer':21 'object':56 'place':53 'problem':14 'project':31 'public':67 'recent':40 'releas':29,65 'requir':45,64 'rewrit':47 'schema':2,6,8,18,55,76,77 'solv':12 'stabl':28 'support':58 'syntax':60 'tool':49 'unlik':42 'updat':41 'v3':7 'v4':10 'version':23 'work':50","created_at":"2026-06-07T16:55:43.094580+00:00","updated_at":"2026-06-07T16:55:43.094580+00:00","problems":[{"fix":"Ensure package is installed: npm install json-schema-compatibility; then use var api = require('json-schema-compatibility');","cause":"Incorrect import path or module not installed.","error":"TypeError: api.v4 is not a function"},{"fix":"Include the library script before using: <script src='path/to/json-schema-compatibility.js'></script>","cause":"Missing script include or script loading order in browser.","error":"Uncaught ReferenceError: JsonSchemaCompatibility is not defined"},{"fix":"Pass the schema through api.v4() to convert 'divisibleBy' to 'multipleOf'.","cause":"Schema still in v3 format; tool not applied correctly.","error":"JSON Schema validation error: unknown keyword 'divisibleBy'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"json-schema-compatibility","openapi_spec":null,"status_page":null,"smithery":null,"categories":["developer-tools"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}