{"_id":"@redocly/allof-merge","_rev":"3-52be075d040edcae75d4bc08b9eabc8a","name":"@redocly/allof-merge","dist-tags":{"latest":"0.6.9"},"versions":{"0.6.8":{"name":"@redocly/allof-merge","version":"0.6.8","keywords":["json","schema","json-schema","jsonschema","openapi","swagger","allof","merge","resolve","simplify"],"author":{"name":"Damir Yusipov"},"license":"MIT","_id":"@redocly/allof-merge@0.6.8","maintainers":[{"name":"romanhotsiy","email":"gotsijroman@gmail.com"},{"name":"alawar","email":"olexandr.varchuk@gmail.com"},{"name":"adamaltman","email":"adam@rebilly.com"},{"name":"marshevskyy","email":"marshevskyy@gmail.com"},{"name":"volodymyr-rutskyi","email":"rutskyi.v@gmail.com"},{"name":"slavikbezkorovainyi","email":"slavik@redocly.com"}],"nx":{"namedInputs":{"prod":["!{projectRoot}/tests/**"]}},"dist":{"shasum":"d47118adefe8b63d40dbc0d1bf0e50535bae7e0a","tarball":"https://registry.npmjs.org/@redocly/allof-merge/-/allof-merge-0.6.8.tgz","fileCount":52,"integrity":"sha512-O4acNHHam5YH44fskvVHZn4Pt9DDE676MCAZ5/dlWjTGFjjSWXigItMJoMyDrUBHtezSM1VrYzjvbJgqJGErEA==","signatures":[{"sig":"MEQCIHj2gmQItGg1ghw2NtYUoNcX2Dey1/aPXXBqRaEwAkrlAiAcCbGBEQ3fsJI9zbSaAASNztHoEUIIAeheUN4e/8ytSA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":143952},"main":"./lib/index.js","type":"module","types":"./lib/index.d.ts","module":"./lib/index.js","gitHead":"191c1c70d2ea1b8835dbf6473d5ba83c21b62714","scripts":{"test":"nx run vitest:test","build":"pnpm run clean && tsgo","clean":"rimraf lib","ts:check":"tsgo --noEmit"},"_npmUser":{"name":"romanhotsiy","email":"gotsijroman@gmail.com"},"_npmVersion":"11.16.0","description":"Simplify JsonSchema/Openapi by combining allOf safely","directories":{},"_nodeVersion":"26.3.0","dependencies":{"json-crawl":"^0.5.3"},"_hasShrinkwrap":false,"devDependencies":{"gqlapi":"^0.5.1","rimraf":"catalog:","vitest":"catalog:","graphql":"catalog:","js-yaml":"catalog:","typescript":"catalog:","@types/js-yaml":"catalog:","@vitest/coverage-v8":"catalog:"},"_npmOperationalInternal":{"tmp":"tmp/allof-merge_0.6.8_1781265666450_0.3848067915396114","host":"s3://npm-registry-packages-npm-production"}},"0.6.9":{"name":"@redocly/allof-merge","version":"0.6.9","keywords":["json","schema","json-schema","jsonschema","openapi","swagger","allof","merge","resolve","simplify"],"author":{"name":"Damir Yusipov"},"license":"MIT","_id":"@redocly/allof-merge@0.6.9","maintainers":[{"name":"romanhotsiy","email":"gotsijroman@gmail.com"},{"name":"alawar","email":"olexandr.varchuk@gmail.com"},{"name":"adamaltman","email":"adam@rebilly.com"},{"name":"marshevskyy","email":"marshevskyy@gmail.com"},{"name":"volodymyr-rutskyi","email":"rutskyi.v@gmail.com"},{"name":"slavikbezkorovainyi","email":"slavik@redocly.com"}],"nx":{"namedInputs":{"prod":["!{projectRoot}/tests/**"]}},"dist":{"shasum":"4c3af3d772cb358e2237a933772bb99dfd5fabb8","tarball":"https://registry.npmjs.org/@redocly/allof-merge/-/allof-merge-0.6.9.tgz","fileCount":52,"integrity":"sha512-r/89c3IqaRk6lFHfif2/WEndX8NCmYUztEhQMk6g7xdxeKJ63y9ZxnDvkJ+i6womKtfiA/tbYYi6NjQ56z02ow==","signatures":[{"sig":"MEYCIQD+S5oSPgi8CtioLiM7a0HA0XTt9a2M3z8cfCOji8CjkgIhAPUmT5ib/7dG044shdVFP96ZEQhDp8F2YDBVDTLXeO5s","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":143932},"main":"./lib/index.js","type":"module","_from":"file:redocly-allof-merge-0.6.9.tgz","types":"./lib/index.d.ts","module":"./lib/index.js","scripts":{"test":"nx run vitest:test","build":"pnpm run clean && tsgo","clean":"rimraf lib","ts:check":"tsgo --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b004a5c5-536a-4445-92e2-73a040fe1274"}},"_resolved":"/tmp/487721c0714fb35acb2e74a931dc6833/redocly-allof-merge-0.6.9.tgz","_integrity":"sha512-r/89c3IqaRk6lFHfif2/WEndX8NCmYUztEhQMk6g7xdxeKJ63y9ZxnDvkJ+i6womKtfiA/tbYYi6NjQ56z02ow==","_npmVersion":"11.13.0","description":"Simplify JsonSchema/Openapi by combining allOf safely","directories":{},"_nodeVersion":"24.16.0","dependencies":{"json-crawl":"^0.5.3"},"_hasShrinkwrap":false,"devDependencies":{"gqlapi":"^0.5.1","rimraf":"5.0.7","vitest":"4.1.8","graphql":"16.12.0","js-yaml":"4.1.1","typescript":"6.0.3","@types/js-yaml":"4.0.9","@vitest/coverage-v8":"4.1.8"},"_npmOperationalInternal":{"tmp":"tmp/allof-merge_0.6.9_1781513431715_0.2651764885568384","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-06-12T12:01:06.208Z","modified":"2026-07-20T13:32:14.987Z","0.6.8":"2026-06-12T12:01:06.605Z","0.6.9":"2026-06-15T08:50:31.888Z"},"author":{"name":"Damir Yusipov"},"license":"MIT","keywords":["json","schema","json-schema","jsonschema","openapi","swagger","allof","merge","resolve","simplify"],"description":"Simplify JsonSchema/Openapi by combining allOf safely","maintainers":[{"email":"gotsijroman@gmail.com","name":"romanhotsiy"},{"email":"olexandr.varchuk@gmail.com","name":"alawar"},{"email":"adam@rebilly.com","name":"adamaltman"},{"email":"marshevskyy@gmail.com","name":"marshevskyy"},{"email":"rutskyi.v@gmail.com","name":"volodymyr-rutskyi"}],"readme":"# @redocly/allof-merge\n\nThis is a fork of [allof-merge](https://github.com/udamir/allof-merge) maintained by Redocly. The original package is MIT-licensed; the upstream `LICENSE` is preserved alongside this README.\n\n---\n\n> Merge schemas with allOf into a more readable composed schema free from allOf.\n\n## Features\n- Safe merging of schemas combined with allOf in whole document\n- Fastest implmentation - up to x3 times faster then other popular libraries\n- Merged schema does not validate more or less than the original schema\n- Removes almost all logical impossibilities\n- Correctly merge additionalProperties, patternProperties and properties taking into account common validations\n- Correctly merge items and additionalItems taking into account common validations\n- Supports custom rules to merge other document types and JsonSchema versions\n- Supports input with circular references (javaScript references)\n- Supports $refs and circular $refs either (internal references only)\n- Correctly merge of $refs with sibling content (optionally)\n- Correctly merge of combinaries (anyOf, oneOf) with sibling content (optionally)\n- Typescript syntax support out of the box\n- No dependencies (except json-crawl), can be used in nodejs or browser\n\n## Works perfectly with specifications:\n\n- [JsonSchema](https://json-schema.org/draft/2020-12/json-schema-core.html)\n- [OpenApi 3.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md)\n- [GraphApi](https://github.com/udamir/graphapi)\n- ~~Swagger 2.x~~ (roadmap)\n- ~~AsyncApi 2.x~~ (roadmap)\n- ~~AsyncApi 3.x~~ (roadmap)\n\n## Other libraries\nThere are some libraries that can merge schemas combined with allOf. One of the most popular is [mokkabonna/json-schema-merge-allof](https://www.npmjs.com/package/json-schema-merge-allof), but it has some limitatons: Does not support circular $refs and no Typescript syntax out of the box.\n\n## External $ref\nIf schema contains an external $ref, you should bundle it via [api-ref-bundler](https://github.com/udamir/api-ref-bundler) first.\n\n## Installation\n```SH\nnpm install @redocly/allof-merge --save\n```\n\n## Usage\n\n### Nodejs\n```ts\nimport { merge } from '@redocly/allof-merge'\n\nconst data = {\n  type: ['object', 'null'],\n  additionalProperties: {\n    type: 'string',\n    minLength: 5\n  },\n  allOf: [{\n    type: ['array', 'object'],\n    additionalProperties: {\n      type: 'string',\n      minLength: 10,\n      maxLength: 20\n    }\n  }]\n}\n\nconst onMergeError = (msg) => {\n  throw new Error(msg)\n}\n\nconst merged = merge(data, { onMergeError })\n\nconsole.log(merged)\n// {\n//   type: 'object',\n//   additionalProperties: {\n//     type: 'string',\n//     minLength: 10,\n//     maxLength: 20\n//   }\n// }\n\n```\n\n## Documentation\n\n### `merge(data: any, options?: MergeOptions)`\nCreate a copy of `data` with merged allOf schemas:\n\n\n### Merge options\n```ts\ninterface MergeOptions {\n  // source document if merging only part of it\n  // (optional) default = data\n  source?: any          \n  \n  // custom merge rules\n  // (optional) default = auto select based on the input (jsonSchemaMergeRules, openApiMergeRules, graphapiMergeRules)\n  rules?: MergeRules    \n\n  // merge $ref with sibling content\n  // (optional) default = false\n  mergeRefSibling?: boolean  \n\n  // merge anyOf/oneOf with sibling content\n  // (optional) default = false\n  mergeCombinarySibling?: boolean  \n\n  // Merge error hook, called on any merge conflicts\n  onMergeError?: (message: string, path: JsonPath, values: any[]) => void\n\n  // Ref resolve error hook, called on broken ref\n  onRefResolveError?: (message: string, path: JsonPath, ref: string) => void\n}\n```\n\n### Supported rules\nYou can find supported rules in the src/rules directory of this repository:\n- `jsonSchemaMergeRules(version: \"draft-04\" | \"draft-06\")`\n- `openApiMergeRules(version: \"3.0.x\" | \"3.1.x\")`\n- `graphapiMergeRules`\n\n## Contributing\nThis package keeps the upstream goal of no additional runtime dependencies (`json-crawl` only). Run unit tests before submitting a PR:\n\n```SH\npnpm --filter @redocly/allof-merge test\n```\n\n## License\n\nMIT — see [LICENSE](./LICENSE). Original work copyright Damir Yusipov.\n","readmeFilename":"README.md"}