-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deepLinking configuration variable to Swagger plugin
- Loading branch information
1 parent
dbcbff9
commit 7f0f904
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,48 @@ class SwaggerTest { | |
window.ui = SwaggerUIBundle({ | ||
url: '/swagger/documentation.yaml', | ||
dom_id: '#swagger-ui', | ||
deepLinking: false, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
], | ||
layout: 'StandaloneLayout' | ||
}); | ||
}</script> | ||
</body> | ||
</html> | ||
""".trimIndent(), | ||
response | ||
) | ||
} | ||
|
||
@Test | ||
fun testSwaggerAllowDeepLinking() = testApplication { | ||
routing { | ||
swaggerUI("swagger") { | ||
deepLinking = true | ||
} | ||
} | ||
|
||
val response = client.get("/swagger").bodyAsText() | ||
assertEquals( | ||
""" | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Swagger UI</title> | ||
<link href="https://unpkg.com/[email protected]/swagger-ui.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div id="swagger-ui"></div> | ||
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin="anonymous"></script> | ||
<script src="https://unpkg.com/[email protected]/swagger-ui-standalone-preset.js" crossorigin="anonymous"></script> | ||
<script>window.onload = function() { | ||
window.ui = SwaggerUIBundle({ | ||
url: '/swagger/documentation.yaml', | ||
dom_id: '#swagger-ui', | ||
deepLinking: true, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
|
@@ -74,6 +116,7 @@ class SwaggerTest { | |
window.ui = SwaggerUIBundle({ | ||
url: '/swagger/documentation.yaml', | ||
dom_id: '#swagger-ui', | ||
deepLinking: false, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
|