feat(swagger-ui-react): Enable displayRequestDuration prop (#7522)

* feat(react): allow displayRequestDuration via react

* docs(react): added displayRequestDuration prop

* Update flavors/swagger-ui-react/README.md

Co-authored-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
Mahtis Michel
2022-01-18 19:24:34 +01:00
committed by GitHub
parent 3af8acf758
commit 85597b9a94
2 changed files with 7 additions and 0 deletions

View File

@@ -132,6 +132,10 @@ Controls whether the "Try it out" section should start enabled. The default is f
⚠️ 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. ⚠️ 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.
#### `displayRequestDuration`: PropTypes.bool
Controls the display of the request duration (in milliseconds) for "Try it out" requests. The default is false.
#### `filter`: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]) #### `filter`: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag. See Swagger UI's [Plug Points](https://github.com/swagger-api/swagger-ui/blob/master/docs/customization/plug-points.md#fnopsfilter) to customize the filtering behavior. If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag. See Swagger UI's [Plug Points](https://github.com/swagger-api/swagger-ui/blob/master/docs/customization/plug-points.md#fnopsfilter) to customize the filtering behavior.

View File

@@ -26,6 +26,7 @@ export default class SwaggerUI extends React.Component {
defaultModelExpandDepth: this.props.defaultModelExpandDepth, defaultModelExpandDepth: this.props.defaultModelExpandDepth,
displayOperationId: this.props.displayOperationId, displayOperationId: this.props.displayOperationId,
tryItOutEnabled: this.props.tryItOutEnabled, tryItOutEnabled: this.props.tryItOutEnabled,
displayRequestDuration: this.props.displayRequestDuration,
requestSnippetsEnabled: this.props.requestSnippetsEnabled, requestSnippetsEnabled: this.props.requestSnippetsEnabled,
requestSnippets: this.props.requestSnippets, requestSnippets: this.props.requestSnippets,
showMutatedRequest: typeof this.props.showMutatedRequest === "boolean" ? this.props.showMutatedRequest : true, showMutatedRequest: typeof this.props.showMutatedRequest === "boolean" ? this.props.showMutatedRequest : true,
@@ -118,6 +119,7 @@ SwaggerUI.propTypes = {
requestSnippetsEnabled: PropTypes.bool, requestSnippetsEnabled: PropTypes.bool,
requestSnippets: PropTypes.object, requestSnippets: PropTypes.object,
tryItOutEnabled: PropTypes.bool, tryItOutEnabled: PropTypes.bool,
displayRequestDuration: PropTypes.bool,
} }
SwaggerUI.defaultProps = { SwaggerUI.defaultProps = {
@@ -129,6 +131,7 @@ SwaggerUI.defaultProps = {
defaultModelRendering: "example", defaultModelRendering: "example",
presets: [], presets: [],
deepLinking: false, deepLinking: false,
displayRequestDuration: false,
showExtensions: false, showExtensions: false,
filter: false, filter: false,
requestSnippetsEnabled: false, requestSnippetsEnabled: false,