0.1.0 • Published 2 years ago

json2mongoose v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

JsonSchema to Mongoose Model Generator

This tool allows you to generate Mongoose models from JSON schemas.

Installation

Install the package globally using npm:

npm install json2mongoose -g

Usage

Command Line Interface (CLI)

To use the tool from the command line, run the following command:

json2mongoose ./jsonSchema ./output

Node

You can also use the tool programmatically in your Node.js scripts:

import json2mongoose from "json2mongoose"

const schemaDir = "path/to/jsonSchema";
const modelDir = "path/to/model";
const typeDir = "path/to/types";

json2mongoose.genarate(schemaDir: string, modelDir: string, typeDir: string);

Please replace the paths with the actual paths to your JSON schemas and output directory.

Note

The generated file is named based on the schema file's name.
the x-documentConfig.documentName will only effect on mongoose api.
ex: docuemt interface, schema, model.

if you don't wish to drop your hair after some bug came out,
match the schema file name with document name.

To Do

[] validation of json schema, - x-foreignKey collection exist
-

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.

0.4.4

10 months ago

0.4.1

11 months ago

0.4.0

11 months ago

0.4.3

10 months ago

0.4.2

11 months ago

0.3.6

12 months ago

0.3.5

1 year ago

0.3.8

11 months ago

0.3.7

12 months ago

0.3.2

1 year ago

0.3.3

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

2 years ago

0.2.1

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago