mohsen1 / multi-file-swagger-example

Multi-file Swagger example
http://azimi.me/2015/07/16/split-swagger-into-smaller-files.html
168 stars 39 forks source link

Updating dependencies which allows for nested reference resolution #21

Closed ClaudioConsolmagno closed 5 years ago

ClaudioConsolmagno commented 5 years ago

Updating to latest versions:

"commander": "^2.19.0",
"js-yaml": "^3.12.2",
"json-refs": "^3.0.12"

Updates allow nested references to be resolved which was added on json-refs@3.0.2 as per this https://github.com/whitlockjc/json-refs/issues/27

Have also added a lightweight regression test that can be used to show the changes: paths/index.yaml references paths/nested.yaml. Running npm test against previous dependencies would result in a broken /nested schema as such (SameFileReference definition doesn't appear anywhere):

  /nested:
    get:
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/nested/SameFileReference'

With this update, /nested schema is inlined:

  /nested:
    get:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              name:
                type: string