lib/index.js
function compile() {
    ensureInitialised('compile');
    if (state.app.name === 'router') {
        state.app = { _router: state.app };
    }
    if (!state.app._router) {
        throw new Error("app._router was null, either your app is not an express app, or you have called compile before adding at least one route");
    }
    state.document = generate(state);
    state.compiled = true;
}
function compile() {
    ensureInitialised('compile');
    if (state.app.name === 'router') {
        state.app = { _router: state.app };
    }
    if (!state.app._router) {
        throw new Error("app._router was null, either your app is not an express app, or you have called compile before adding at least one route");
    }
    state.document = generate(state);
    state.compiled = true;
}
function compile ( ) { ensureInitialised ( 'compile' ) ; if ( state . app . name === 'router' ) { state . app = { _router : state . app } ; } if ( ! state . app . _router ) { throw new Error ( "app._router was null, either your app is not an express app, or you have called compile before adding at least one route" ) ; } state . document = generate ( state ) ; state . compiled = true ; }
Will gather together all your described app routes and compile them into a single document to be served up by your api when you call `json`.
Can only be called once `initialise` has been called. Should only call this once you have completely finished describing your routes.
@returns {void}
@throws {Error} Will throw an error if `initialise` wasn't called or if you don't yet have any routes defined or if there are certain errors in your metadata
@example
var swagger = require('swagger-spec-express');
var express = require('express');
var router = new express.Router();
swagger.swaggerize(router);
router.get('/', function (req, res) {
//...
}).describe({
//...
});
swagger.compile();
Will gather together all your described app routes and compile them into a single document to be served up by your api when you call json . Can only be called once initialise has been called . Should only call this once you have completely finished describing your routes .