Skip to content

Commit

Permalink
feat(swagger-ui-react): add showCommonExtensions option (#8436)
Browse files Browse the repository at this point in the history
  • Loading branch information
afrkorsakow authored Mar 7, 2023
1 parent 9895e37 commit 6b56e38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flavors/swagger-ui-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions flavors/swagger-ui-react/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -146,6 +148,7 @@ SwaggerUI.defaultProps = {
deepLinking: false,
displayRequestDuration: false,
showExtensions: false,
showCommonExtensions: false,
filter: false,
requestSnippetsEnabled: false,
requestSnippets: {
Expand Down

0 comments on commit 6b56e38

Please sign in to comment.