-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Cannot read property 'slice' of undefined #4807
Description
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 hereSwagger-UI configuration options:
SwaggerUI({
// your config options here
})?yourQueryStringConfig
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- 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