feat(swagger-ui-react): add support for layout prop (#6639)

layout prop represents the name of a component available
via the plugin system to use as the top-level
layout for Swagger UI.
This commit is contained in:
Vladimir Gorej
2020-11-19 23:12:32 +01:00
committed by GitHub
parent d2ef8f31b9
commit a6673d7c60
2 changed files with 13 additions and 3 deletions

View File

@@ -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: [],