Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gentics/mesh-model-generator
Generates TypeScript Models from the Gentics Mesh RAML spec
https://github.com/gentics/mesh-model-generator
mesh models raml-codegen raml-converter raml-tooling typescript-generator
Last synced: about 2 months ago
JSON representation
Generates TypeScript Models from the Gentics Mesh RAML spec
- Host: GitHub
- URL: https://github.com/gentics/mesh-model-generator
- Owner: gentics
- License: other
- Created: 2017-03-20T15:57:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-02T06:56:47.000Z (about 2 years ago)
- Last Synced: 2024-09-18T20:45:02.400Z (4 months ago)
- Topics: mesh, models, raml-codegen, raml-converter, raml-tooling, typescript-generator
- Language: TypeScript
- Size: 396 KB
- Stars: 3
- Watchers: 11
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generator to render model interfaces from Gentics Mesh RAML
[![npm version](https://badge.fury.io/js/mesh-model-generator.svg)](https://www.npmjs.com/package/mesh-model-generator)
### NOTE
This package is work in progress and not ready for production use. It requires Gentics Mesh 0.8.x+
Render the server interfaces returned by [Mesh](http://getmesh.io/) as type definitions which can be used in TypeScript.
Designed for use with TypeScript, but can be extended for other languages.## Usage as a module
```bash
npm install mesh-model-generator
``````TypeScript
import { readFileSync, writeFileSync } from 'fs';
import { parseAndGenerate } from 'mesh-model-generator';const inputFile = readFileSync('./my-api.raml', 'utf-8');
parseAndGenerate(inputFile)
.then(generatedModels => {
writeFileSync('./my-models.ts', generatedModels, 'utf-8');
})
.catch(err => console.error(err));
```## Generating from the CLI
```Bash
npm install -g mesh-model-generator
mesh-model-generator my-api.raml > model-declarations.ts
```## License
[MIT](LICENSE)