JamesMessinger / swagger-server

No longer maintained. Please use https://github.com/BigstickCarpet/swagger-express-middleware
MIT License
149 stars 47 forks source link

fix nodejs 6.x error with resolving path from object #34

Closed lysek closed 1 year ago

lysek commented 7 years ago

an error started to apper when parsing swagger API from JSON object like this with new nodejs 6.9.1:

parser.dereference("swagger.yaml", {
    $refs: {
        internal: false
    }
}).then(function (api) {
    server.parse(api);
    server.listen(1000, function () {
        console.log('Your REST API is now running at http://localhost:1000');
    });
});

path.dirname() in parser.js throws errors when passed an object instead of string.

I needed to divide API docs into smaller files and I wanted to use refs without filename to generate one single JSON back from.