mesh-model-generator
v0.3.1
Published
Generate model interfaces from Gentics Mesh RAML declarations
Downloads
36
Readme
Generator to render model interfaces from Gentics Mesh RAML
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 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
npm install mesh-model-generator
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
npm install -g mesh-model-generator
mesh-model-generator my-api.raml > model-declarations.ts