{"id":48279,"library":"json-schema-merge-allof","title":"json-schema-merge-allof","description":"Safely merge JSON Schema allOf compositions into a single, readable schema by resolving logical intersections and conflicts. v0.8.1 supports most JSON Schema core/validation keywords (v6), correctly handles additionalProperties, patternProperties, items, and dependencies. Unlike simple schema merging tools, it throws on logical impossibilities and uses keyword-specific resolution (intersection, union, min/max) to preserve validation semantics. Stable with low release cadence. Suitable for schema authors who want to eliminate allOf from their schemas without changing validation behavior. Supports pluggable resolvers for custom keywords. Node.js >=12.0.0 required.","status":"active","version":"0.8.1","language":"javascript","source_language":"en","source_url":"https://github.com/mokkabonna/json-schema-merge-allof","tags":["javascript","json","schema","jsonschema"],"install":[{"cmd":"npm install json-schema-merge-allof","lang":"bash","label":"npm"},{"cmd":"yarn add json-schema-merge-allof","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-schema-merge-allof","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for resolving allOf references; not required by end users.","package":"json-schema-resolve-allof","optional":true}],"imports":[{"note":"ESM default export since v0.7.0. For CommonJS use `const mergeAllOf = require('json-schema-merge-allof').default`.","wrong":"const mergeAllOf = require('json-schema-merge-allof')","symbol":"default","correct":"import mergeAllOf from 'json-schema-merge-allof'"},{"note":"CJS default export, not named. Destructuring will give undefined.","wrong":"const { mergeAllOf } = require('json-schema-merge-allof')","symbol":"mergeAllOf","correct":"const mergeAllOf = require('json-schema-merge-allof')"},{"note":"Options type is exported as a property of the default export; not a separate named export.","wrong":"import { Options } from 'json-schema-merge-allof'","symbol":"mergeAllOf.Options","correct":"import mergeAllOf from 'json-schema-merge-allof'; const options: mergeAllOf.Options = { ignoreAdditionalProperties: true }"}],"quickstart":{"code":"import mergeAllOf from 'json-schema-merge-allof';\n\nconst schema = {\n  type: 'object',\n  properties: {\n    name: { type: 'string' }\n  },\n  allOf: [\n    {\n      properties: {\n        age: { type: 'integer' }\n      },\n      required: ['age']\n    },\n    {\n      additionalProperties: false\n    }\n  ]\n};\n\ntry {\n  const merged = mergeAllOf(schema);\n  console.log(JSON.stringify(merged, null, 2));\n} catch (error) {\n  console.error('Merge failed:', error.message);\n}","lang":"typescript","description":"Merges an allOf array with a root schema, combining properties and required fields while honoring additionalProperties: false."},"warnings":[{"fix":"Use `import mergeAllOf from 'json-schema-merge-allof'` or in CJS: `const mergeAllOf = require('json-schema-merge-allof').default`.","message":"Default export changed from a named function to a default export in v0.7.0. Using require('...') without .default in ESM will fail.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Call `mergeAllOf(schema, { ignoreAdditionalProperties: true })` to allow merging even when additionalProperties is false.","message":"Merging schemas with `additionalProperties: false` in one of the allOf members will cause an error by default (logical impossibility). Use `ignoreAdditionalProperties: true` option to override, but be aware the result will be less restrictive.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use `mergeAllOf(schema, { customResolvers: { myKeyword: resolverFunction } })` instead of `{ resolvers: ... }`.","message":"Options object previously accepted `resolvers` as a direct property; in v0.6.0+ it should be passed as `customResolvers`.","severity":"deprecated","affected_versions":">=0.6.0"},{"fix":"Ensure your schema is compliant with draft-06 or later, or provide custom resolvers for non-standard keywords.","message":"The library assumes all input schemas are valid JSON Schema (draft-06+). Using draft-04 or older keywords like `extends` may not merge correctly.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Review your schema for logical contradictions that would yield an empty intersection.","message":"If the allOf array contains contradictory constraints (e.g., type: 'string' and type: 'number') the merge will throw an error because no logical intersection exists.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'12.0.0':89 'additionalproperti':33 'allof':5,10,74 'author':69 'behavior':81 'cadenc':65 'chang':79 'composit':11 'conflict':22 'core/validation':28 'correct':31 'custom':86 'depend':37 'elimin':73 'handl':32 'imposs':47 'intersect':20,54 'item':35 'javascript':91 'json':2,8,26,92 'json-schema-merge-allof':1 'jsonschema':94 'keyword':29,51,87 'keyword-specif':50 'logic':19,46 'low':63 'merg':4,7,41 'min/max':56 'node.js':88 'patternproperti':34 'pluggabl':83 'preserv':58 'readabl':15 'releas':64 'requir':90 'resolut':53 'resolv':18,84 'safe':6 'schema':3,9,16,27,40,68,77,93 'semant':60 'simpl':39 'singl':14 'specif':52 'stabl':61 'suitabl':66 'support':24,82 'throw':44 'tool':42 'union':55 'unlik':38 'use':49 'v0.8.1':23 'v6':30 'valid':59,80 'want':71 'without':78","created_at":"2026-06-07T16:55:49.322183+00:00","updated_at":"2026-06-07T16:55:49.322183+00:00","problems":[{"fix":"Change to `const mergeAllOf = require('json-schema-merge-allof').default;` or switch to ESM `import`.","cause":"Using CommonJS require without .default when the library is ESM-only in newer versions.","error":"TypeError: mergeAllOf is not a function"},{"fix":"Use the `ignoreAdditionalProperties: true` option, or ensure all allOf members have compatible additionalProperties settings.","cause":"One allOf member has `additionalProperties: false` while another defines `properties` or `additionalProperties` with object.","error":"Error: Can not merge schemas with different additionalProperties values: false vs ..."},{"fix":"Remove or adjust the type constraints in the allOf members to have a common type.","cause":"Contradictory type constraints in allOf members (e.g., object vs array).","error":"Error: No intersection found for keyword type between [\"object\"] and [\"array\"]"},{"fix":"Use default import: `import mergeAllOf from 'json-schema-merge-allof'`.","cause":"Importing as named export `{ mergeAllOf }` instead of default import.","error":"mergeAllOf(...) is not a function (TypeError)"}],"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-merge-allof#readme","github":"https://github.com/mokkabonna/json-schema-merge-allof","docs":null,"changelog":null,"pypi":null,"npm":"json-schema-merge-allof","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"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}}