diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index 316bdd0fb94..1cba34ae5eb 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -43,6 +43,12 @@ Remote URL to an OpenAPI document that Swagger UI will fetch, parse, and display ⚠️ Don't use this in conjunction with `spec` - unpredictable behavior may occur. +#### `layout`: PropTypes.string + +The name of a component available via the plugin system to use as the top-level layout for Swagger UI. The default value is `BaseLayout`. + +⚠️ 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. + #### `onComplete`: PropTypes.func > `(system) => void` diff --git a/flavors/swagger-ui-react/index.js b/flavors/swagger-ui-react/index.js index 6c1169879c9..31f27b8e6b6 100644 --- a/flavors/swagger-ui-react/index.js +++ b/flavors/swagger-ui-react/index.js @@ -13,6 +13,7 @@ export default class SwaggerUI extends React.Component { plugins: this.props.plugins, spec: this.props.spec, url: this.props.url, + layout: this.props.layout, defaultModelsExpandDepth: this.props.defaultModelsExpandDepth, presets: [presets.apis,...this.props.presets], requestInterceptor: this.requestInterceptor, @@ -85,23 +86,26 @@ SwaggerUI.propTypes = { PropTypes.object, ]), url: PropTypes.string, + layout: PropTypes.string, requestInterceptor: PropTypes.func, responseInterceptor: PropTypes.func, onComplete: PropTypes.func, - docExpansion: PropTypes.oneOf(['list', 'full', 'none']), + docExpansion: PropTypes.oneOf(["list", "full", "none"]), supportedSubmitMethods: PropTypes.arrayOf( - PropTypes.oneOf(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']) + PropTypes.oneOf(["get", "put", "post", "delete", "options", "head", "patch", "trace"]) ), plugins: PropTypes.arrayOf(PropTypes.object), displayOperationId: PropTypes.bool, showMutatedRequest: PropTypes.bool, defaultModelExpandDepth: PropTypes.number, + defaultModelsExpandDepth: PropTypes.number, presets: PropTypes.arrayOf(PropTypes.func), deepLinking: PropTypes.bool, } SwaggerUI.defaultProps = { - supportedSubmitMethods: ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'], + layout: "BaseLayout", + supportedSubmitMethods: ["get", "put", "post", "delete", "options", "head", "patch", "trace"], docExpansion: "list", defaultModelsExpandDepth: 1, presets: [],