question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v3 - Resolver error - Cannot read property '1' of undefined

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
scottoharacommented, Mar 5, 2018

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)

1reaction
heldersepucommented, Feb 5, 2018

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

.errors-wrapper {
    display: none !IMPORTANT;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

No operations defined in spec! && Resolver error Cannot read ...
The "/api/category" path is missing the "get": node that would wrap the GET operation definition. It should look like this: "paths" ...
Read more >
Solved: Editor full of resolver errors - SmartBear Community
Now I revisited our API and it happens to be full of errors of this type: Resolver error. Cannot read property 'properties' of...
Read more >
Uncaught TypeError: Cannot read property '1' of undefined
This error is because there is a property field in that model, on that form that doesn't have his generic value defined, probably...
Read more >
[SOLVED] Cannot Read Property of Undefined in JavaScript
The “cannot read property of undefined” error occurs when you attempt to access a property or method of a variable that is undefined...
Read more >
Solved: Error when integrating Custom API: Cannot read pro...
Solved: Hi, when Integrating the following custom API i get the Error: Cannot read property 'parameters' of undefined. Same happens when I use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found