summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphadej <>2019-06-11 22:09:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-06-11 22:09:00 (GMT)
commitb920293b1d1b222e8ac6f8faf6363747e1251e0b (patch)
treebb4ad3db6208aa90819bde5256450f637ba55326
parenta5ec628bafb385db9785a9066207c35eece4e114 (diff)
version 0.3.4.3.22.2HEAD0.3.4.3.22.2master
-rwxr-xr-xCHANGELOG.md3
-rwxr-xr-xindex.html.tmpl11
-rw-r--r--servant-swagger-ui.cabal2
3 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb337bc..a6d2666 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+- 0.3.4.3.22.2
+ - Fix #67: We didn't use served `swagger.json`
+
- 0.3.3.3.22.2
- Update to `swagger-ui-3.22.2`
- Add `swaggerSchemaUIServer'`
diff --git a/index.html.tmpl b/index.html.tmpl
index 955bdd7..3c07b6f 100755
--- a/index.html.tmpl
+++ b/index.html.tmpl
@@ -47,9 +47,18 @@
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
+ // servant-swagger-ui addition
+ var ssuDir = "SERVANT_SWAGGER_UI_DIR";
+ var ssuSchema = "SERVANT_SWAGGER_UI_SCHEMA";
+ // more concretely:
+ // replace /swagger-ui/ or /swagger-ui/index.html with /swagger.json
+ // we always have trailing slash!
+ var re = new RegExp("\/" + ssuDir + "/(?:index\\.html)?$","g");
+ var url = window.location.pathname.replace(re, "/" + ssuSchema);
+
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
- url: "https://petstore.swagger.io/v2/swagger.json",
+ url: url,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
diff --git a/servant-swagger-ui.cabal b/servant-swagger-ui.cabal
index 95ebb6c..a9c94ae 100644
--- a/servant-swagger-ui.cabal
+++ b/servant-swagger-ui.cabal
@@ -1,6 +1,6 @@
cabal-version: 1.12
name: servant-swagger-ui
-version: 0.3.3.3.22.2
+version: 0.3.4.3.22.2
synopsis: Servant swagger ui
category: Web, Servant, Swagger
description: