swagger-server icon indicating copy to clipboard operation
swagger-server copied to clipboard

fix nodejs 6.x error with resolving path from object

Open lysek opened this issue 9 years ago • 1 comments

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.

lysek avatar Nov 08 '16 14:11 lysek