Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose system object in swagger-ui-react's onComplete callback #5221

Merged
merged 3 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions flavors/swagger-ui-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ Remote URL to an OpenAPI document that Swagger UI will fetch, parse, and display

#### `onComplete`: PropTypes.func

> `(system) => void`

A callback function that is triggered when Swagger-UI finishes rendering an OpenAPI document.

Swagger UI's `system` object is passed as an argument.

#### `requestInterceptor`: PropTypes.func

> `req => req` or `req => Promise<req>`.
Expand Down
4 changes: 2 additions & 2 deletions flavors/swagger-ui-react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class SwaggerUI extends React.Component {

onComplete = () => {
if (typeof this.props.onComplete === "function") {
return this.props.onComplete()
return this.props.onComplete(this.system)
}
}
}
Expand All @@ -80,4 +80,4 @@ SwaggerUI.propTypes = {
requestInterceptor: PropTypes.func,
responseInterceptor: PropTypes.func,
onComplete: PropTypes.func,
}
}