Model Parser is a comprehensive tool designed to parse model definitions from various sources and generate corresponding TypeScript types. It supports input from local files as well as Cosmos DB. This tool makes it easy to convert model definitions into TypeScript types, streamlining the development process.
- File-based Model Parsing: Parse model definitions from local files and generate TypeScript types.
- Cosmos DB Integration: Fetch model definitions from Cosmos DB and generate TypeScript types.
- Automatic Directory Creation: Automatically create necessary directories if they don't exist.
- Pretty-printed Output: Generate well-formatted and readable TypeScript definition files.
-
Clone the repository:
git clone https://github.com/StanMarek/rust-model-definition-parser mdparser cd mdparser -
Build the project:
make build
or
cargo build
-
Install the executable:
make release
-
Running executable:
mdparser
-
Running in debug mode:
cargo
mdparser --helpGenerate TypeScript definitions from a local model file:
mdparser generate file --source path/to/model.txt --target path/to/output.ts
mdparser generate file --source model.txt --target output.ts
Fetch model definitions from Cosmos DB and generate TypeScript types:
mdparser generate cosmos --url mongodb://localhost:27017 --db_name mydb --collection mycollection --search myfield --value myvalue --model_field mymodel
mdparser generate cosmos --url mongodb://localhost:27017 --db_name mydb --collection mycollection --search id --value 12345 --model_field myModelField
I welcome contributions!
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Make your changes.
- Commit your changes (git commit -am 'Add new feature').
- Push to the branch (git push origin feature-branch).
- Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Stan Marek


