swagger-mock-api icon indicating copy to clipboard operation
swagger-mock-api copied to clipboard

YAML files, are building?

Open brunosalgueiro opened this issue 8 years ago • 4 comments

When I try YAML files, Grunt can't execute "connect" command, if I change the file for JSON it works fine.

bruno@bruno-VirtualBox:~/Documentos/repositorio/PlataformaWeb/api/mock$ grunt Running "connect:server" (connect) task Waiting forever... Started connect web server on http://localhost:8000 Fatal error: Cannot read property 'default' of undefined

That's the grunt file

'use strict';

var path = require('path');
var mockApi = require('swagger-mock-api');

module.exports = function(grunt) {
  grunt.initConfig({
    connect: {
      server: {
        options: {
          keepalive: true,
          middleware: [
            mockApi({
                swaggerFile: path.join(__dirname, "..", "specs/financial/financing-proposal/financing-proposal.yaml"),
                watch: true // enable reloading the routes and schemas when the swagger file changes
            })
          ],
        },
      },
    },
  });
  grunt.loadNpmTasks('grunt-contrib-connect');

  grunt.registerTask('default', ['connect']);
};

brunosalgueiro avatar Apr 11 '16 14:04 brunosalgueiro

Interesting... I've got a hunch, I'll try to take a look at it in a day or so. It's probably a defect in swagger-parser, since the file path itself is just passed straight through to that library.

Currently, this library is a good major version behind swagger-parser, so I'll try to reproduce and see if a version bump fixes it.

If I don't see anything obvious, I may hold out a little bit as version 4 of swagger-parser is in beta right now and should bring some nice features as well.

dzdrazil avatar Apr 19 '16 05:04 dzdrazil

+1, facing the same issue.

xeniatay avatar Jul 12 '16 00:07 xeniatay

same issue +1

yingnansong avatar Jul 28 '16 15:07 yingnansong

bump

awmottaz avatar Mar 13 '18 23:03 awmottaz