File tree Expand file tree Collapse file tree 2 files changed +60
-4
lines changed
Expand file tree Collapse file tree 2 files changed +60
-4
lines changed Original file line number Diff line number Diff line change @@ -190,10 +190,10 @@ async fn run_server(
190190 if config. apidoc . enabled {
191191 match config. apidoc . doc_type {
192192 config:: ApiDocType :: Swagger => {
193- // router = router.route(
194- // &config.apidoc.path,
195- // get(move || async { Html(include_str!("openapi/swagger.html")) }),
196- // );
193+ router = router. route (
194+ & config. apidoc . path ,
195+ get ( move || async { Html ( include_str ! ( "openapi/swagger.html" ) ) } ) ,
196+ ) ;
197197 }
198198 config:: ApiDocType :: Redoc => {
199199 router = router. route (
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Swagger UI</ title >
6+ < link rel ="
stylesheet "
type ="
text/css "
href ="
https://unpkg.com/[email protected] /swagger-ui.css "
/> 7+ < link rel ="
icon "
type ="
image/png "
href ="
https://unpkg.com/[email protected] /favicon-32x32.png "
sizes ="
32x32 "
/> 8+ < link rel ="
icon "
type ="
image/png "
href ="
https://unpkg.com/[email protected] /favicon-16x16.png "
sizes ="
16x16 "
/> 9+ < style >
10+ html {
11+ box-sizing : border-box;
12+ overflow : -moz-scrollbars-vertical;
13+ overflow-y : scroll;
14+ }
15+
16+ * ,
17+ * : before ,
18+ * : after {
19+ box-sizing : inherit;
20+ }
21+
22+ body {
23+ margin : 0 ;
24+ background : # fafafa ;
25+ }
26+ </ style >
27+ </ head >
28+
29+ < body >
30+ < div id ="swagger-ui "> </ div >
31+
32+ < script src ="
https://unpkg.com/[email protected] /swagger-ui-bundle.js "
> </ script > 33+ < script src ="
https://unpkg.com/[email protected] /swagger-ui-standalone-preset.js "
> </ script > 34+ < script >
35+ window . onload = function ( ) {
36+ // get the base part of the URL
37+ const baseUrl = window . location . protocol + '//' + window . location . host ;
38+
39+ // initialize Swagger UI
40+ window . ui = SwaggerUIBundle ( {
41+ url : baseUrl + "/openapi.json" , // OpenAPI specification JSON
42+ dom_id : '#swagger-ui' ,
43+ deepLinking : true ,
44+ presets : [
45+ SwaggerUIBundle . presets . apis ,
46+ SwaggerUIStandalonePreset
47+ ] ,
48+ plugins : [
49+ SwaggerUIBundle . plugins . DownloadUrl
50+ ] ,
51+ layout : "StandaloneLayout"
52+ } ) ;
53+ } ;
54+ </ script >
55+ </ body >
56+ </ html >
You can’t perform that action at this time.
0 commit comments