swagger-ui: v3 - Resolver error - Cannot read property '1' of undefined

This error occured when we upgraded to swagger ui 3.x. We use swagger-ui-dist@3.0.18.

The issue can be reproduced with the following swagger-spec on Swagger Editor:

# this is an bug report spec
swagger: '2.0'
info:
  title: Swagger UI 3 Bug Report
  description: |
    This will display the following error:
  
    ## Resolver error
    
    `Cannot read property '1' of undefined`
  version: 1.0.0
host: localhost
schemes:
  - https
basePath: /v1
produces:
  - application/json
paths:
  /resolver-error:
    get:
      tags:
        - Bug Report
      responses:
        200:
          description: The trouble maker
          schema:
            $ref: '#/definitions/foo-bar'

definitions:
  foo-bar:
    allOf:
      - $ref: '#/definitions/baz'
      - properties:
          data:
            type: array
            items:
              $ref: '#/definitions/foo'

  foo:
    allOf:
      - $ref: '#/definitions/bar'
      - properties:
          foo:
            type: string

  bar:
    properties:
      bar:
        type: string
      foo:
        $ref: '#/definitions/foo'

  baz:
    properties:
      baz:
        type: string

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I’m happy to report that Swagger UI v3.12.0 (presumably this specific fix: https://github.com/swagger-api/swagger-ui/pull/4273) now correctly resolves two examples above that were previously failing with Resolver error: Cannot read property '<prop>' of undefined (https://github.com/swagger-api/swagger-ui/issues/3366#issuecomment-366096404 and https://github.com/swagger-api/swagger-ui/issues/3366#issuecomment-366565475)

@stoutfiles if hiding the error is all want, try a custom css:

.errors-wrapper {
    display: none !IMPORTANT;
}