Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持多后端语言实现接口文档渲染 #827

Open
iszhangsc opened this issue Aug 17, 2024 · 1 comment
Open

支持多后端语言实现接口文档渲染 #827

iszhangsc opened this issue Aug 17, 2024 · 1 comment

Comments

@iszhangsc
Copy link

能否像swagger-ui-dist 那样,提供一个 CSSJS 文件的CDN,然后由后端使用一个 html文件引入这两个文件, 并添加相应的配置即可. 如下是使用 swagger-ui-dist 的使用示例

<!DOCTYPE html>
<html>
<head>
    <link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css">
    <link rel="shortcut icon" href="https://fastapi.tiangolo.com/img/favicon.png">
    <title>fastapi接口文档标题 - Swagger UI</title>
</head>
<body>
<div id="swagger-ui">
</div>
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
<!-- `SwaggerUIBundle` is now available on the page -->
<script>
    const ui = SwaggerUIBundle({
        url: '/v3/api-docs/default',
    "dom_id": "#swagger-ui",
"layout": "BaseLayout",
"deepLinking": true,
"showExtensions": true,
"showCommonExtensions": true,
oauth2RedirectUrl: window.location.origin + '/docs/oauth2-redirect',
    presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIBundle.SwaggerUIStandalonePreset
        ],
    })
</script>
</body>
</html>
@HHC26
Copy link

HHC26 commented Aug 27, 2024

希望其他后端语言也能否使用这个好看的ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants