Skip to content

Commit 6b56e38

Browse files
authored
feat(swagger-ui-react): add showCommonExtensions option (#8436)
1 parent 9895e37 commit 6b56e38

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

flavors/swagger-ui-react/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ Controls the display of vendor extension (`x-`) fields and values for Operations
114114

115115
⚠️ 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.
116116

117+
#### `showCommonExtensions`: PropTypes.bool
118+
119+
Controls the display of extensions (pattern, maxLength, minLength, maximum, minimum) fields and values for Parameters.
120+
121+
⚠️ 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.
122+
117123
#### `showMutatedRequest`: PropTypes.bool
118124

119125
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.

flavors/swagger-ui-react/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default class SwaggerUI extends React.Component {
3333
showMutatedRequest: typeof this.props.showMutatedRequest === "boolean" ? this.props.showMutatedRequest : true,
3434
deepLinking: typeof this.props.deepLinking === "boolean" ? this.props.deepLinking : false,
3535
showExtensions: this.props.showExtensions,
36+
showCommonExtensions: this.props.showCommonExtensions,
3637
filter: ["boolean", "string"].includes(typeof this.props.filter) ? this.props.filter : false,
3738
persistAuthorization: this.props.persistAuthorization,
3839
withCredentials: this.props.withCredentials,
@@ -122,6 +123,7 @@ SwaggerUI.propTypes = {
122123
presets: PropTypes.arrayOf(PropTypes.func),
123124
deepLinking: PropTypes.bool,
124125
showExtensions: PropTypes.bool,
126+
showCommonExtensions: PropTypes.bool,
125127
filter: PropTypes.oneOfType([
126128
PropTypes.string,
127129
PropTypes.bool,
@@ -146,6 +148,7 @@ SwaggerUI.defaultProps = {
146148
deepLinking: false,
147149
displayRequestDuration: false,
148150
showExtensions: false,
151+
showCommonExtensions: false,
149152
filter: false,
150153
requestSnippetsEnabled: false,
151154
requestSnippets: {

0 commit comments

Comments
 (0)