From 6b56e3828eceb5d7a724cecd9dce3ce6165096a1 Mon Sep 17 00:00:00 2001 From: afrkorsakow <126677750+afrkorsakow@users.noreply.github.com> Date: Tue, 7 Mar 2023 23:25:08 +0900 Subject: [PATCH] feat(swagger-ui-react): add showCommonExtensions option (#8436) --- flavors/swagger-ui-react/README.md | 6 ++++++ flavors/swagger-ui-react/index.jsx | 3 +++ 2 files changed, 9 insertions(+) diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index cf6806fdfbd..8aaad5e36f9 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -114,6 +114,12 @@ Controls the display of vendor extension (`x-`) fields and values for Operations ⚠️ 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. +#### `showCommonExtensions`: PropTypes.bool + +Controls the display of extensions (pattern, maxLength, minLength, maximum, minimum) fields and values for Parameters. + +⚠️ 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. + #### `showMutatedRequest`: PropTypes.bool If set to `true`, uses the mutated request returned from a requestInterceptor to produce the curl command in the UI, otherwise the request before the requestInterceptor was applied is used. diff --git a/flavors/swagger-ui-react/index.jsx b/flavors/swagger-ui-react/index.jsx index dcfe92d279e..0858ec9fe44 100644 --- a/flavors/swagger-ui-react/index.jsx +++ b/flavors/swagger-ui-react/index.jsx @@ -33,6 +33,7 @@ export default class SwaggerUI extends React.Component { showMutatedRequest: typeof this.props.showMutatedRequest === "boolean" ? this.props.showMutatedRequest : true, deepLinking: typeof this.props.deepLinking === "boolean" ? this.props.deepLinking : false, showExtensions: this.props.showExtensions, + showCommonExtensions: this.props.showCommonExtensions, filter: ["boolean", "string"].includes(typeof this.props.filter) ? this.props.filter : false, persistAuthorization: this.props.persistAuthorization, withCredentials: this.props.withCredentials, @@ -122,6 +123,7 @@ SwaggerUI.propTypes = { presets: PropTypes.arrayOf(PropTypes.func), deepLinking: PropTypes.bool, showExtensions: PropTypes.bool, + showCommonExtensions: PropTypes.bool, filter: PropTypes.oneOfType([ PropTypes.string, PropTypes.bool, @@ -146,6 +148,7 @@ SwaggerUI.defaultProps = { deepLinking: false, displayRequestDuration: false, showExtensions: false, + showCommonExtensions: false, filter: false, requestSnippetsEnabled: false, requestSnippets: {