morphlingjs icon indicating copy to clipboard operation
morphlingjs copied to clipboard

Crashing on in-line `schema`, moving under `definitions` resolves it

Open netmilk opened this issue 6 years ago • 1 comments

The Error

$ morphling bash
Container ID is:
584d6828db74
Bashing into Morphling.. Type exit to exit.
root@584d6828db74:/usr/app# pm2 log
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
  0|server  | Error in getDB TypeError: Cannot read property 'replace' of undefined
  0|server  |     at getReferencesAndCount (/usr/app/src/utils/createRouterFromSwagger.js:189:46)
  0|server  |     at /usr/app/src/utils/createRouterFromSwagger.js:125:29
  0|server  |     at dispatch (/usr/app/node_modules/koa-router/node_modules/koa-compose/index.js:44:32)
  0|server  |     at next (/usr/app/node_modules/koa-router/node_modules/koa-compose/index.js:45:18)
  0|server  |     at /usr/app/node_modules/koa-router/lib/router.js:345:16
  0|server  |     at dispatch (/usr/app/node_modules/koa-router/node_modules/koa-compose/index.js:44:32)
  0|server  |     at /usr/app/node_modules/koa-router/node_modules/koa-compose/index.js:36:12
  0|server  |     at dispatch (/usr/app/node_modules/koa-router/lib/router.js:350:31)
  0|server  |     at dispatch (/usr/app/node_modules/koa-compose/index.js:42:32)
  0|server  |     at dispatch (/usr/app/node_modules/koa-router/lib/router.js:332:32)
  0|server  | (node:17) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.

The OpenAPI 2 document

swagger: "2.0"

info:
  version: 1.0.0
  title: Simple API
  description: A simple API to learn how to write OpenAPI Specification

schemes:
  - https

host: simple.api
basePath: /


paths:
  /persons:
    get:
      summary: Gets some persons
      description: Returns a list containing all persons.
      responses:
        200:
          description: A list of Person
          schema:
            type: array
            items:
              required:
                - username
              properties:
                firstName:
                  type: string
                lastName:
                  type: string
                username:
                  type: string

netmilk avatar Oct 23 '18 13:10 netmilk

Thanks for the feedback! Would you be willing to submit a PR on this?

vroudge avatar Oct 23 '18 16:10 vroudge