Skip to content
Sandor edited this page Dec 23, 2016 · 12 revisions

Welcome to the gl-swagger-generator wiki!

Getting Started

Three different approaches are now available to use this generator.

Gulp

npm install node-swagger-generator@beta --save-dev
npm install gulp-swagger-generator@beta --save-dev
var gulp = require("gulp"),
    path = require("path"),
    swaggerGenerator = require('gulp-swagger-generator'),


gulp.task('swagger:ts', function () {
    return gulp.src('./api-swagger.json')
        .pipe(swaggerGenerator({
            "language": "typescript",
            "framework": "angular",
            "version": "1.5",
            "mode": "singleFile",
            "dependencies": {
                
            },
            "mediaTypesPriorities": {
                "application/json": 1
            },
            "ambientTypes": [
            ],
            "templateOptions": {
                "clientName": "MyClient",
                "module": "MyModule"
            }
        }))
        .pipe(gulp.dest("./ClientDirectory"));
});

CLI

Coming soon.

Node

node-swagger-generator is built as a node module you can directly integrate in your node based scripts or tools.

Coming soon.

Features

Languages

  • CSharp : Note the generic support is currently extremely limited. *
  • Typescript : Generics are not supported atm.

Known issues and limitations

  • Not advanced date/time management especially in TypeScript
  • Generics are mostly not supported atm.

Extend

Custom Templates

As opposed to former gulp-swagger-generator, this new version will support writing custom templates out of the box.

Checkout detailed instructions

Language Pack

Coming soon.

How it works

input : swagger schema

swagger visitors :

  • customVisitors (extensibility point) ;
  • detect definitions (both explicit and anonymous) and build operations --> users definition and operation filters (extensibility point);

generation context visitors

  • type trimmer -> uses dependencies
  • type mapper -> uses language provider

extensibility points

todo ->

  • generation context should keep track of underlying swagger schema objects.
  • templates: fix indentation
Clone this wiki locally