title: Swagger-jsdoc does not ref yaml file
body: <p>My <code>swagger-jsdoc</code> and <code>swagger-ui-express</code> setup to document my express app is apparently unable to read or reference YAML files that I am pointing them to</p>
  
  <p>I am still learning how to document APIs, and I was using this article <a href="https://www.codementor.io/peteradeoye/splitting-your-swagger-spec-into-multiple-files-in-a-node-project-nuprc0mej" rel="noreferrer">https://www.codementor.io/peteradeoye/splitting-your-swagger-spec-into-multiple-files-in-a-node-project-nuprc0mej</a> as a guide but I am unable to replicate the desired results </p>
  
  <p>This is my app.js</p>
  
  <pre><code>import 'core-js/stable';
  import 'regenerator-runtime/runtime';
  import express from 'express';
  import bodyParser from 'body-parser';
  import cors from 'cors';
  import swaggerUI from 'swagger-ui-express';
  import swaggerSpec from './config/swagger';
  import allRoutes from './routes';
  
  
  const app = express();
  
  app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerSpec));
  app.use(cors());
  app.use(bodyParser.urlencoded({
    extended: true,
  }));
  app.use(bodyParser.json());
  
  allRoutes(app);
  
  export default app;
  </code></pre>
  
  <p>This is my swagger config at <code>./config/swagger</code></p>
  
  <pre><code>const swaggerJSDoc = require('swagger-jsdoc');
  
  const swaggerDefinition = {
    info: {
      title: 'REST API for Wayfarer', // Title of the documentation
      version: '1.0.0', // Version of the app
      description: 'This is the REST API for Wayfarer (a public bus transportation booking server.)', // short description of the app
    },
    host: 'localhost:3000', // the host or url of the app
    basePath: '/api/v1', // the basepath of your endpoint
  };
  
  // options for the swagger docs
  const options = {
    // import swaggerDefinitions
    swaggerDefinition,
    // path to the API docs
    apis: ['./docs/**/*.yaml'],
  };
  // initialize swagger-jsdoc
  export default swaggerJSDoc(options);
  </code></pre>
  
  <p>and this is one of the yaml I am referencing at <code>./docs/user.yaml</code></p>
  
  <pre><code>paths:
    /auth/signup:                # path of the user from your endpoint
      post:                 # endpoint request type (post request)
        tags:               # Tag property
          - User            # Value of the tag
        summary: creates a new user
        produces:
        - application/json
        parameters:         # request parameters
        - in: body          # request body
          name: sign up     # name of the request, can be any name
          description: It enables a user to create an account
          required: false   # can also be true depending on user preference
          schema:           # Schema definition
            $ref: '#/definitions/signUp' 
        responses:          # server responses
          201:
            description: An object with user details
  definitions:        # Schema definition for the request body
    signUp:
      type: object
          properties:
            username:
              type: string
            email:
              type: string
            password:
              type: string
  
  </code></pre>
  
  <p>I was expecting to see some info to be displayed when I try to view my documentation but what I see in my browser is <code>No operations defined in the spec</code>. I managed to narrow down the problem to</p>
  
  <pre><code>...
  const options = {
    // import swaggerDefinitions
    swaggerDefinition,
    // path to the API docs
    apis: ['./docs/**/*.yaml'],
  };
  ...
  </code></pre>
  
  <p>For some reason</p>
  
  <pre><code>...
  apis: ['./docs/**/*.yaml'],
  };
  ...
  </code></pre>
  
  <p>just refuses to work, I have renamed my <code>docs</code> folder too and that did not help.
  I moved my <code>docs</code> folder to the root of my project, the error message changed to <code>Error: TypeError: Cannot convert undefined or null to object</code></p>