{"id":48261,"library":"json-schema-compare","title":"json-schema-compare","description":"Compare JSON schemas intelligently, ignoring order and normalization differences. Version 0.2.2 is the latest stable release. The library handles sorting of arrays (like required, enum, type, dependencies), treats undefined/true/{} as equivalent, and allows ignoring specific keywords via options. It is designed for JSON schema comparison in Node.js, with CommonJS support only.","status":"active","version":"0.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/mokkabonna/json-schema-compare","tags":["javascript","json","schema","jsonschema","json-schema","comparison"],"install":[{"cmd":"npm install json-schema-compare","lang":"bash","label":"npm"},{"cmd":"yarn add json-schema-compare","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-schema-compare","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS-only; no ES module export.","wrong":"import compare from 'json-schema-compare'","symbol":"default (compare function)","correct":"const compare = require('json-schema-compare')"}],"quickstart":{"code":"const compare = require('json-schema-compare');\n\nconst schema1 = {\n  type: 'object',\n  required: ['name', 'age'],\n  properties: {\n    name: { type: 'string' },\n    age: { type: 'number', minimum: 0 }\n  }\n};\n\nconst schema2 = {\n  type: 'object',\n  required: ['age', 'name'],\n  properties: {\n    name: { type: 'string' },\n    age: { type: 'number', minimum: 0 }\n  }\n};\n\nconst isEqual = compare(schema1, schema2);\nconsole.log(isEqual); // true","lang":"javascript","description":"Demonstrates comparing two JSON schemas with different key ordering, returning true because the package normalizes arrays."},"warnings":[{"fix":"If you need strict equality, don't use this library; rely on deep equality libraries.","message":"The comparison treats undefined, true, and {} as equivalent for any schema or sub-schema. Be aware when expecting strict equality.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If distinction is needed, set the value to -1 or use a custom comparator.","message":"For minLength, minItems, and minProperties, undefined and 0 are considered equal. This might cause unexpected results if you rely on the presence of a minimum constraint.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set uniqueItems explicitly to true or false if you need to distinguish.","message":"For uniqueItems, undefined and false are treated as equal. This aligns with JSON Schema spec, but may surprise users expecting strict boolean comparison.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using @hyperjump/json-schema or ajv for newer draft support; for simple comparison, keep using this library.","message":"The package has not been updated since 2019. No known breaking changes, but it may lack support for newer JSON Schema drafts (2020-12, 2019-09).","severity":"deprecated","affected_versions":"0.2.2"}],"env_vars":null,"search_vec":"'0.2.2':15 'allow':37 'array':26 'commonj':53 'compar':4,5 'comparison':49,63 'depend':31 'design':45 'differ':13 'enum':29 'equival':35 'handl':23 'ignor':9,38 'intellig':8 'javascript':56 'json':2,6,47,57,61 'json-schema':60 'json-schema-compar':1 'jsonschema':59 'keyword':40 'latest':18 'librari':22 'like':27 'node.js':51 'normal':12 'option':42 'order':10 'releas':20 'requir':28 'schema':3,7,48,58,62 'sort':24 'specif':39 'stabl':19 'support':54 'treat':32 'type':30 'undefined/true':33 'version':14 'via':41","created_at":"2026-06-07T16:55:43.023137+00:00","updated_at":"2026-06-07T16:55:43.023137+00:00","problems":[{"fix":"Run npm install json-schema-compare --save and ensure the require is 'json-schema-compare' (not mispelled).","cause":"Package not installed or wrong require path.","error":"Cannot find module 'json-schema-compare'"},{"fix":"Use const compare = require('json-schema-compare'); (CommonJS).","cause":"Incorrect import method (using ES module import or destructuring incorrectly).","error":"compare is not a function"},{"fix":"Pass options as an object, e.g., compare(schema1, schema2, { ignore: ['title'] }).","cause":"Third argument provided is not an object.","error":"Options must be an object"}],"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":"https://github.com/mokkabonna/json-schema-compare#readme","github":"https://github.com/mokkabonna/json-schema-compare","docs":null,"changelog":null,"pypi":null,"npm":"json-schema-compare","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"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}}