From e3625414892d72d55ff97014e4c3200d30a727f7 Mon Sep 17 00:00:00 2001 From: Glen Schrader Date: Wed, 6 Mar 2019 09:13:42 -0700 Subject: [PATCH 1/2] expose swagger object so it can be controlled in the onComplete function --- flavors/swagger-ui-react/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flavors/swagger-ui-react/index.js b/flavors/swagger-ui-react/index.js index bd24c9e2aa7..c19ca93b841 100644 --- a/flavors/swagger-ui-react/index.js +++ b/flavors/swagger-ui-react/index.js @@ -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) } } } @@ -80,4 +80,4 @@ SwaggerUI.propTypes = { requestInterceptor: PropTypes.func, responseInterceptor: PropTypes.func, onComplete: PropTypes.func, -} \ No newline at end of file +} From 41299efe9d35e33abe8db9b282e0a52153206b18 Mon Sep 17 00:00:00 2001 From: kyle Date: Thu, 14 Mar 2019 19:22:21 -0700 Subject: [PATCH 2/2] docs: swagger-ui-react onComplete system argument --- flavors/swagger-ui-react/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index 0fefd5b6c97..b3d9feb1814 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -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`.