{"_id":"@audc/convert-json-schema-to-mongoose","_rev":"4-6977f88e056544701c925315958cb139","name":"@audc/convert-json-schema-to-mongoose","dist-tags":{"latest":"1.0.2"},"versions":{"0.3.6":{"name":"@audc/convert-json-schema-to-mongoose","version":"0.3.6","keywords":["json","schema","convert","mongo","mongoose"],"license":"MIT","_id":"@audc/convert-json-schema-to-mongoose@0.3.6","maintainers":[{"name":"orgads","email":"orgads@gmail.com"}],"homepage":"https://github.com/kristianmandrup/convert-json-schema-to-mongoose","bugs":{"url":"https://github.com/kristianmandrup/convert-json-schema-to-mongoose/issues"},"dist":{"shasum":"ed9f65e5eb3d1b057356644448c741f078a3419d","tarball":"https://registry.npmjs.org/@audc/convert-json-schema-to-mongoose/-/convert-json-schema-to-mongoose-0.3.6.tgz","fileCount":12,"integrity":"sha512-9LOikiGXM7pWFNGGCcpcqwjPou+S0kRAOcxcddmq6HHQI1YUoHtFUHjyDR+QD3hoo/j1ofqxela3aPZhzGeZJQ==","signatures":[{"sig":"MEUCIQDlWW+NvcKwM3+jqt1AHa+o05jibRKrgNkWZ5LHyd/hLQIgaMljGEFo++CJuGUFgLr31Gjwn/PLw/9Tz8YcBEHWPF0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26023},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"bb510262faf9692608b48e655282f430a76db717","private":false,"scripts":{"test":"jasmine ./dist/test/*.js","build":"tsc","start":"node dist/index.js"},"_npmUser":{"name":"orgads","email":"orgads@gmail.com"},"repository":{"url":"git+https://github.com/kristianmandrup/convert-json-schema-to-mongoose.git","type":"git"},"_npmVersion":"10.9.2","description":"A library for converting JSON schema to mongoose 5 schema","directories":{},"_nodeVersion":"23.6.0","dependencies":{"lodash":"^4.17.21","mongoose":"^8.9.5"},"_hasShrinkwrap":false,"devDependencies":{"jasmine":"^5.5.0","typescript":"^5.7.3","@types/node":"^22.10.7","@types/lodash":"^4.17.14","@types/jasmine":"^5.1.5","@tsconfig/node20":"^20.1.4"},"_npmOperationalInternal":{"tmp":"tmp/convert-json-schema-to-mongoose_0.3.6_1737318253765_0.7017190567592608","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@audc/convert-json-schema-to-mongoose","version":"1.0.0","keywords":["json","schema","convert","mongo","mongoose"],"license":"MIT","_id":"@audc/convert-json-schema-to-mongoose@1.0.0","maintainers":[{"name":"orgads","email":"orgads@gmail.com"}],"homepage":"https://github.com/kristianmandrup/convert-json-schema-to-mongoose","bugs":{"url":"https://github.com/kristianmandrup/convert-json-schema-to-mongoose/issues"},"dist":{"shasum":"5d76c0b913db7f026bdd72419e1c95a6c0965c8e","tarball":"https://registry.npmjs.org/@audc/convert-json-schema-to-mongoose/-/convert-json-schema-to-mongoose-1.0.0.tgz","fileCount":12,"integrity":"sha512-zx9GMu6a2fny2klumlbDuVuEgDc/Ov3OHCy7J5hQ7qRi24mFcdl0XxD5E0P0q25AYFxnDXMnHpQ9nyy3F2SNRw==","signatures":[{"sig":"MEUCIQCH3L0q38RTKIPTL9jbFHi6I/Abea2rSHq/eyrIN1bR6gIgdq/mpNZBvm+qB/+M5qlvBUg8vY4OCYXz40ARTaxH6Sc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25587},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"881edb2eb93419e236bd4e63155e30021a61520e","private":false,"scripts":{"test":"vitest run","build":"tsc","start":"node dist/index.js","test:watch":"vitest"},"_npmUser":{"name":"orgads","email":"orgads@gmail.com"},"repository":{"url":"git+https://github.com/kristianmandrup/convert-json-schema-to-mongoose.git","type":"git"},"_npmVersion":"11.6.1","description":"A library for converting JSON schema to mongoose 5 schema","directories":{},"_nodeVersion":"24.11.0","dependencies":{"lodash":"^4.17.21","mongoose":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.14","typescript":"^5.9.3","@types/node":"^24.10.1","@types/lodash":"^4.17.21","@tsconfig/node22":"^22.0.5"},"_npmOperationalInternal":{"tmp":"tmp/convert-json-schema-to-mongoose_1.0.0_1764522086359_0.8702385874141434","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@audc/convert-json-schema-to-mongoose","version":"1.0.1","keywords":["json","schema","convert","mongo","mongoose"],"license":"MIT","_id":"@audc/convert-json-schema-to-mongoose@1.0.1","maintainers":[{"name":"orgads","email":"orgads@gmail.com"}],"homepage":"https://github.com/kristianmandrup/convert-json-schema-to-mongoose","bugs":{"url":"https://github.com/kristianmandrup/convert-json-schema-to-mongoose/issues"},"dist":{"shasum":"f80aee77a04d401f7554aaf65c5d9b971ee0e539","tarball":"https://registry.npmjs.org/@audc/convert-json-schema-to-mongoose/-/convert-json-schema-to-mongoose-1.0.1.tgz","fileCount":12,"integrity":"sha512-GGcb4wdrQpEdX3yQZYfqNMzIc2Iay5XSkwOpN+9fJsumu7WUjBGOJHhoF3nSnTLD97rz/Vj7o2xLzZX/3tKhAA==","signatures":[{"sig":"MEUCIQCauqwUa6dRHfW3KGY9yNaDb8YvJUpiCRPXQLb3bYsvcQIgGT1nGKE0Z2Yi0lZpvnwcysqUmGGC8mKnXxZ6JTR75lM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24740},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"55a85e4a972a4427bf6a7f2e9a0af84d94b1f131","private":false,"scripts":{"test":"vitest run","build":"tsc","start":"node dist/index.js","test:watch":"vitest"},"_npmUser":{"name":"orgads","email":"orgads@gmail.com"},"repository":{"url":"git+https://github.com/kristianmandrup/convert-json-schema-to-mongoose.git","type":"git"},"_npmVersion":"11.6.2","description":"A library for converting JSON schema to mongoose 5 schema","directories":{},"_nodeVersion":"25.2.1","dependencies":{"lodash":"^4.17.21","mongoose":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.14","typescript":"^5.9.3","@types/node":"^24.10.1","@types/lodash":"^4.17.21","@tsconfig/node22":"^22.0.5"},"_npmOperationalInternal":{"tmp":"tmp/convert-json-schema-to-mongoose_1.0.1_1764525333831_0.6400331001470263","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@audc/convert-json-schema-to-mongoose","version":"1.0.2","description":"A library for converting JSON schema to mongoose 5 schema","keywords":["json","schema","convert","mongo","mongoose"],"type":"module","homepage":"https://github.com/audiocodes/convert-json-schema-to-mongoose","repository":{"url":"git+https://github.com/audiocodes/convert-json-schema-to-mongoose.git","type":"git"},"bugs":{"url":"https://github.com/audiocodes/convert-json-schema-to-mongoose/issues"},"private":false,"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"vitest run","test:watch":"vitest","start":"node dist/index.js"},"dependencies":{"lodash":"^4.18.1","mongoose":"^9.4.1"},"devDependencies":{"@tsconfig/node22":"^22.0.5","@types/lodash":"^4.17.24","@types/node":"^24.12.2","typescript":"^6.0.2","vitest":"^4.1.4"},"gitHead":"0f50af66bc65347f4243b40605a01bb5268ec2e8","_id":"@audc/convert-json-schema-to-mongoose@1.0.2","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-FrmRhETVm2/NglEfGhdmxXQELaNKbdPav6CIzBk77AITHFRORH98B2O6rTT/WT5RDD/P03tDDNhBbXpMLJHGWA==","shasum":"4cc3d44b8cdb21afb0e94d097f57a8bd0ffe2d33","tarball":"https://registry.npmjs.org/@audc/convert-json-schema-to-mongoose/-/convert-json-schema-to-mongoose-1.0.2.tgz","fileCount":12,"unpackedSize":24980,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@audc%2fconvert-json-schema-to-mongoose@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHLrdoJuOtdilkmaf62dmnAnVFnHmpwpwPmVAs6e/LttAiBtWj8QGT6/NWtycCTGr3+sMamoh8sezIhyyL7bXqPnnQ=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:828c595a-948a-4572-af00-59966043a2fc"}},"directories":{},"maintainers":[{"name":"orgads","email":"orgads@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/convert-json-schema-to-mongoose_1.0.2_1775739310082_0.2319333764180278"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-19T20:24:13.678Z","modified":"2026-04-09T12:55:10.531Z","0.3.6":"2025-01-19T20:24:13.997Z","1.0.0":"2025-11-30T17:01:26.588Z","1.0.1":"2025-11-30T17:55:34.042Z","1.0.2":"2026-04-09T12:55:10.229Z"},"bugs":{"url":"https://github.com/audiocodes/convert-json-schema-to-mongoose/issues"},"license":"MIT","homepage":"https://github.com/audiocodes/convert-json-schema-to-mongoose","keywords":["json","schema","convert","mongo","mongoose"],"repository":{"url":"git+https://github.com/audiocodes/convert-json-schema-to-mongoose.git","type":"git"},"description":"A library for converting JSON schema to mongoose 5 schema","maintainers":[{"name":"orgads","email":"orgads@gmail.com"}],"readme":"# JSON Schema to Mongoose Schema [![NPM version](https://badge.fury.io/js/@audc%2Fconvert-json-schema-to-mongoose.svg)](http://badge.fury.io/js/@audc%2Fconvert-json-schema-to-mongoose)\n\nA translation library between [JSON Schema](http://json-schema.org/) and\n[Mongoose Schema](http://mongoosejs.com/docs/guide.html). Written in TypeScript.\n\nThis project is based on the work of Kristian Mandrup: [github](https://github.com/kristianmandrup/convert-json-schema-to-mongoose), [npm](https://www.npmjs.com/package/convert-json-schema-to-mongoose).\n\nAll the dependencies were updated, and the package is ESM.\n\n## Alternatives\n\nSome of the alternatives...\n\n- 2017 [generate-schema-required](https://www.npmjs.com/package/generate-schema-required)\n- 2016 [mongoosify](https://www.npmjs.com/package/mongoosify)\n- 2016 [mongoose-jsonschema](https://www.npmjs.com/package/mongoose-jsonschema)\n- 2015 [goodeggs-json-schema-converter](https://www.npmjs.com/package/goodeggs-json-schema-converter)\n- 2014 [json-schema-converter](https://www.npmjs.com/package/json-schema-converter)\n- 2014 [json-schema-to-mongoose-schema](https://www.npmjs.com/package/json-schema-to-mongoose-schema)\n\n## Installation\n\n`npm i @audc/convert-json-schema-to-mongoose -S`\n\n## Usage\n\n```typescript\nimport { createMongooseSchema } from 'convert-json-schema-to-mongoose';\n\n// Or use plain javascript\n// const createMongooseSchema = require('json-schema-to-mongoose').default;\n\n// example json-schema references\nconst refs =\n{\n    yep:\n    {\n        type: 'string',\n        pattern: '^\\\\d{3}$'\n    },\n    idSpec: {\n        type: 'object',\n        properties:\n        {\n            id:\n            {\n                $ref: 'yep'\n            }\n        }\n    }\n};\n\n// example schema to convert to mongoose schema\nconst schema =\n{\n    type: 'object',\n    properties:\n    {\n        id:\n        {\n            $ref: 'yep'\n        },\n        address:\n        {\n            type: 'object',\n            properties:\n            {\n                street: {type: 'string', default: '44', pattern: '^\\\\d{2}$'},\n                houseColor: {type: 'string', default: '[Function=Date.now]', format: 'date-time'}\n            }\n        }\n    }\n};\n\n//Convert the schema\nconst mongooseSchema = createMongooseSchema(refs, schema);\n\n//Alternative syntax, which makes it so you can convert many at one time.\n\n// var jsonSchemas = {commonRef: ..., good: ..., schema: ..., naming: ...}\n// var convert = createMongooseSchema(jsonSchemas)\n// var schemaNames = ['good', 'schema', 'naming']\n// var schemas = _.map(schemaNames, (name) => { return jsonSchemas[name] })\n// var mongooseSchemas = _.zipObject(schemaNames, schemas.reduce((mongooseSchemas, schema) => {\n//     return mongooseSchemas.concat(convert(schema))\n// }, []))\n\nconsole.dir(mongooseSchema, {depth: null});\n\nconst Schema = new mongoose.Schema(mongooseSchema);\n\n```\n","readmeFilename":"README.md"}