NPM package based on swagger-ts-generator to generate typescript models for endpoints documented by swagger using the relatively new OpenAPI spec.
import { generateTsModels } from 'openapi-ts-generator';
generateTsModels({
openApiJsonUrl: '{Your Swagger Enpoint URL here}',
outputPath: './{outputFolder}/',
});
import { generateTsModels } from 'openapi-ts-generator';
generateTsModels({
openApiJsonFileName: '{location and file name of your OpenApi document}',
outputPath: './{outputFolder}/',
});
const generator = require('openapi-ts-generator');
generator.generateTsModels({
openApiJsonUrl: '{Your Swagger Enpoint URL here}',
outputPath: './{outputFolder}/',
genAngularFormGroups: true /* Set this to true if only if you're in an Angular project*/
});
const generator = require('openapi-ts-generator');
generator.generateTsModels({
openApiJsonFileName: '{location and file name of your OpenApi document}',
outputPath: './{outputFolder}/',
});
const generator = require('openapi-ts-generator');
generator.generateTsModels({
openApiJsonFileName: '{location and file name of your OpenApi document}',
outputPath: './{outputFolder}/',
genAngularFormGroups: true
});
import { generateTsModels } from 'openapi-ts-generator';
generateTsModels({
openApiJsonUrl: 'https://im-wa-cmpo-nrsr.azurewebsites.net/swagger/v1/swagger.json',
outputPath: './models/',
typeFilterCallBack: (val, i, arr) => !val.name.endsWith('ODataEnvelope'),
valuePropertyTypeFilterCallBack: (val, i, arr) => !val.name.startsWith('created') && !val.name.startsWith('updated'),
});
Check out openapi-mermaid, it will auto-generate mermaid entity diagrams using your swagger docs.