Converts JSON Schema definitions into Mongoose 5 schema objects. Version 0.3.2 is the latest stable release (no recent updates). It handles nested objects, references ($ref), defaults, and formats. Written in TypeScript with type declarations. Alternatives exist but none have more recent activity.
npm install convert-json-schema-to-mongooseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Converts a JSON Schema with a $ref and a property with default into a Mongoose schema object.
Provide an object for refs (even if empty) as first argument, and schema as second.
Use string format '[Function=Date.now]' instead of the actual function.
Consider using a more recent library or manually update the schema for Mongoose 6+.
Add a declaration file or cast the result to 'any' if needed.
Call createMongooseSchema(refs, schema) where refs is an object (can be empty {}).Ensure the schema has { type: 'object' } at the root.Include all referenced schemas in the refs object.
No dependency data recorded yet.