Skip to content

Cannot read property 'slice' of undefined #4807

@Hackniu

Description

@Hackniu

Q&A (please complete the following information)

  • OS: [e.g. macOS]
  • Browser: [e.g. chrome, safari]
  • Version: [e.g. 22]
  • Method of installation: [e.g. npm, dist assets]
  • Swagger-UI version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]

Content & configuration

Example Swagger/OpenAPI definition:

# your YAML here

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Describe the bug you're encountering

To reproduce...

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Screenshots

Additional context or thoughts

I am using:
{
"swagger-ui": "^3.5.0",
"react": "^16.4.1"
}

const React = require('react');
const SwaggerUI = require('swagger-ui');

class Swagger extends React.Component {
componentDidMount() {
SwaggerUI({
dom_id: "#ui",
url: "http://petstore.swagger.io/v2/swagger.json"
});
}

  render() {
     return <div id="ui" />;
  }

}
error: TypeError: Cannot read property 'slice' of undefined
the error is coming from swagger-ui, I try to comment out the componenentDidMount, and only leave the const SwaggerUI = require('swagger-ui'), the error is still there. Please anyone know how to solve the problem, thx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions