From fc24b2e93e1f2dd17f5d14d0a53d9049ad31da58 Mon Sep 17 00:00:00 2001 From: MoOmEeN Date: Mon, 23 Mar 2020 00:17:56 +0000 Subject: [PATCH] support for supportedSubmitMethods property in react component (#5376) * support for supportedSubmitMethods property in react component * update react README Co-authored-by: Radek Co-authored-by: kyle shockey --- flavors/swagger-ui-react/README.md | 6 ++++++ flavors/swagger-ui-react/index.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index b6fa11f666c..8a026e9f12d 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -83,6 +83,12 @@ An array of objects that augment and modify Swagger UI's functionality. See Swag ⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. +#### `supportedSubmitMethods`: PropTypes.arrayOf(PropTypes.oneOf(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'])) + +HTTP methods that have the Try it out feature enabled. An empty array disables Try it out for all operations. This does not filter the operations from the display. + +⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. + ## Limitations * Not all configuration bindings are available. diff --git a/flavors/swagger-ui-react/index.js b/flavors/swagger-ui-react/index.js index 6ba415504de..fd2ed1bde8f 100644 --- a/flavors/swagger-ui-react/index.js +++ b/flavors/swagger-ui-react/index.js @@ -18,6 +18,7 @@ export default class SwaggerUI extends React.Component { responseInterceptor: this.responseInterceptor, onComplete: this.onComplete, docExpansion: this.props.docExpansion, + supportedSubmitMethods: this.props.supportedSubmitMethods, defaultModelExpandDepth: this.props.defaultModelExpandDepth, }) @@ -84,6 +85,9 @@ SwaggerUI.propTypes = { responseInterceptor: PropTypes.func, onComplete: PropTypes.func, docExpansion: PropTypes.oneOf(['list', 'full', 'none']), + supportedSubmitMethods: PropTypes.arrayOf( + PropTypes.oneOf(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']) + ), defaultModelExpandDepth: PropTypes.number, plugins: PropTypes.arrayOf(PropTypes.object), }