feat(swagger-ui-react): defaultModelExpandDepth and plugins props (#5594)

* Add plugins as React prop

* Add defaultModelExpandDepth as React prop

* Add documentation re: defaultModelExpandDepth and plugins props

* Fetched latest and rebased on that

* add on-mount-only warning messages to new options

Co-authored-by: Todd Lemoine <43755148+tlemoine-jama@users.noreply.github.com>
Co-authored-by: kyle shockey <kyleshockey@gmail.com>
This commit is contained in:
Peter Mooney
2020-01-04 17:15:33 -08:00
committed by kyle shockey
parent 87dfc8da26
commit 296f73aa00
2 changed files with 16 additions and 0 deletions

View File

@@ -11,12 +11,14 @@ export default class SwaggerUI extends React.Component {
componentDidMount() {
const ui = swaggerUIConstructor({
plugins: this.props.plugins,
spec: this.props.spec,
url: this.props.url,
requestInterceptor: this.requestInterceptor,
responseInterceptor: this.responseInterceptor,
onComplete: this.onComplete,
docExpansion: this.props.docExpansion,
defaultModelExpandDepth: this.props.defaultModelExpandDepth,
})
this.system = ui
@@ -82,4 +84,6 @@ SwaggerUI.propTypes = {
responseInterceptor: PropTypes.func,
onComplete: PropTypes.func,
docExpansion: PropTypes.oneOf(['list', 'full', 'none']),
defaultModelExpandDepth: PropTypes.number,
plugins: PropTypes.arrayOf(PropTypes.object),
}