krakenjs/hapi-openapi

stripVendorExtensions recursion

JProgrammer opened this issue · 1 comments

Hi with the new stripVendorExtensions on api docs the code does not take into account recursive structures which will result in an error

    at RegExp.[Symbol.match] (<anonymous>)
    at String.match (native)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:50:16)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)
    at stripVendorExtensions (/Users/admj012/projects/bablProducts/node_modules/hapi-openapi/lib/index.js:51:22)

Here is a minimal openapi spec to replicate the issue

swagger: '2.0'
info:
  title: Recursion
  version: 1.0.0
paths:
  /recursion:
    get:
      responses:
        '200':
          description: 200 OK
          schema:
            $ref: '#/definitions/Recursion'
definitions:
  Recursion:
    type: object
    properties:
      healthStatus:
        $ref: '#/definitions/Recursion'
tags: []

Hmm, that function should not be following references at all. Will double check.