git.iko.soy/typeable/servant-swagger-ui
on master help sign in
WIP: split servant-swagger-ui into many packages
commit82ca55faa35121c95620c3cbe3778b6c08a6b2b4 authorOleg Grenrus <oleg.grenrus@iki.fi> dateThu 5 Apr 2018, 12:58 (9 years ago) parenta75c1cd
80 files changed+646−408
.travis.yml+29−10 cabal.project+6 hackage-docs.sh−78 LICENSE → servant-swagger-ui-core/LICENSE servant-swagger-ui-core/servant-swagger-ui-core.cabal+57 src/Servant/Swagger/UI.hs → servant-swagger-ui-core/src/Servant/Swagger/UI/Core.hs+5−76 servant-swagger-ui-example/LICENSE+30 Setup.hs → servant-swagger-ui-example/Setup.hs−1 servant-swagger-ui-example/servant-swagger-ui-example.cabal+36 example/Main.hs → servant-swagger-ui-example/src/Main.hs+8−22 servant-swagger-ui-jensoleg/LICENSE+45 jensoleg-dist/css/api-explorer.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/api-explorer.css jensoleg-dist/css/index.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/index.css jensoleg-dist/css/print.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/print.css jensoleg-dist/css/reset.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/reset.css jensoleg-dist/css/screen.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/screen.css jensoleg-dist/css/standalone.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/standalone.css jensoleg-dist/css/typography.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/typography.css jensoleg-dist/fonts/droid-sans-v6-latin-700.eot → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.eot jensoleg-dist/fonts/droid-sans-v6-latin-700.svg → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.svg jensoleg-dist/fonts/droid-sans-v6-latin-700.ttf → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.ttf jensoleg-dist/fonts/droid-sans-v6-latin-700.woff → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.woff jensoleg-dist/fonts/droid-sans-v6-latin-700.woff2 → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.woff2 jensoleg-dist/fonts/droid-sans-v6-latin-regular.eot → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.eot jensoleg-dist/fonts/droid-sans-v6-latin-regular.svg → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.svg jensoleg-dist/fonts/droid-sans-v6-latin-regular.ttf → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.ttf jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff2 → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff2 jensoleg-dist/images/Swagger_explorer.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/Swagger_explorer.png jensoleg-dist/images/Swagger_explorer_min.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/Swagger_explorer_min.png jensoleg-dist/images/explorer_icons.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/explorer_icons.png jensoleg-dist/images/favicon-16x16.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/favicon-16x16.png jensoleg-dist/images/favicon-32x32.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/favicon-32x32.png jensoleg-dist/images/favicon.ico → servant-swagger-ui-jensoleg/jensoleg-dist/images/favicon.ico jensoleg-dist/images/json_editor_integration.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/json_editor_integration.png jensoleg-dist/images/logo_small.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/logo_small.png jensoleg-dist/images/pet_store_api.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/pet_store_api.png jensoleg-dist/images/senodio.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/senodio.png jensoleg-dist/images/throbber.gif → servant-swagger-ui-jensoleg/jensoleg-dist/images/throbber.gif jensoleg-dist/images/wordnik_api.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/wordnik_api.png jensoleg-dist/index.html → servant-swagger-ui-jensoleg/jensoleg-dist/index.html jensoleg-dist/lib/backbone-min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/backbone-min.js jensoleg-dist/lib/bootstrap.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/bootstrap.min.js jensoleg-dist/lib/handlebars-2.0.0.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/handlebars-2.0.0.js jensoleg-dist/lib/highlight.7.3.pack.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/highlight.7.3.pack.js jensoleg-dist/lib/jquery-1.8.0.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery-1.8.0.min.js jensoleg-dist/lib/jquery.ba-bbq.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery.ba-bbq.min.js jensoleg-dist/lib/jquery.slideto.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery.slideto.min.js jensoleg-dist/lib/jquery.wiggle.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery.wiggle.min.js jensoleg-dist/lib/jsoneditor.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jsoneditor.js jensoleg-dist/lib/marked.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/marked.js jensoleg-dist/lib/swagger-oauth.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/swagger-oauth.js jensoleg-dist/lib/underscore-min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/underscore-min.js jensoleg-dist/moncierge.json → servant-swagger-ui-jensoleg/jensoleg-dist/moncierge.json jensoleg-dist/o2c.html → servant-swagger-ui-jensoleg/jensoleg-dist/o2c.html jensoleg-dist/petstore.json → servant-swagger-ui-jensoleg/jensoleg-dist/petstore.json jensoleg-dist/swagger-ui.js → servant-swagger-ui-jensoleg/jensoleg-dist/swagger-ui.js jensoleg-dist/swagger-ui.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/swagger-ui.min.js jensoleg-dist/swagger.json → servant-swagger-ui-jensoleg/jensoleg-dist/swagger.json jensoleg.index.html.tmpl → servant-swagger-ui-jensoleg/jensoleg.index.html.tmpl servant-swagger-ui.cabal → servant-swagger-ui-jensoleg/servant-swagger-ui-jensoleg.cabal+9−66 servant-swagger-ui-jensoleg/src/Servant/Swagger/UI/JensOleG.hs+78 servant-swagger-ui-redoc/LICENSE+45 redoc-dist/redoc.min.js → servant-swagger-ui-redoc/redoc-dist-1.21.2/redoc.min.js redoc.index.html.tmpl → servant-swagger-ui-redoc/redoc.index.html.tmpl servant-swagger-ui-redoc/servant-swagger-ui-redoc.cabal+43 servant-swagger-ui-redoc/src/Servant/Swagger/UI/ReDoc.hs+76 CHANGELOG.md → servant-swagger-ui/CHANGELOG.md+6 servant-swagger-ui/LICENSE+45 index.html.tmpl → servant-swagger-ui/index.html.tmpl servant-swagger-ui/servant-swagger-ui.cabal+50 servant-swagger-ui/src/Servant/Swagger/UI.hs+78 swagger-ui-dist-3.9.1/favicon-16x16.png → servant-swagger-ui/swagger-ui-dist-3.9.1/favicon-16x16.png swagger-ui-dist-3.9.1/favicon-32x32.png → servant-swagger-ui/swagger-ui-dist-3.9.1/favicon-32x32.png swagger-ui-dist-3.9.1/swagger-ui-bundle.js → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui-bundle.js swagger-ui-dist-3.9.1/swagger-ui-standalone-preset.js → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui-standalone-preset.js swagger-ui-dist-3.9.1/swagger-ui.css → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui.css swagger-ui-dist-3.9.1/swagger-ui.js → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui.js swagger-ui-dist-3.9.1/index.html−95 swagger-ui-dist-3.9.1/oauth2-redirect.html−60
.travis.yml+29−10
@@ -1,6 +1,6 @@
11# This Travis job script has been generated by a script via
22#
3−# runghc make_travis_yml_2.hs '--branch' 'master' '--output' '.travis.yml' '--config' 'servant-swagger-ui.cabal'
3+# runghc make_travis_yml_2.hs '--branch' 'master' '--output' '.travis.yml' '--config' 'cabal.project'
44#
55# For more information, see https://github.com/hvr/multi-ghc-travis
66#
@@ -70,26 +70,42 @@ install:
7070 - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
7171 - rm -fv cabal.project cabal.project.local
7272 - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
73− - "printf 'packages: \".\"\\n' > cabal.project"
73+ - "printf 'packages: \"servant-swagger-ui\" \"servant-swagger-ui-core\" \"servant-swagger-ui-example\" \"servant-swagger-ui-jensoleg\" \"servant-swagger-ui-redoc\"\\n' > cabal.project"
7474 - cat cabal.project
75− - if [ -f "./configure.ac" ]; then
76− (cd "." && autoreconf -i);
75+ - if [ -f "servant-swagger-ui/configure.ac" ]; then
76+ (cd "servant-swagger-ui" && autoreconf -i);
77+ fi
78+ - if [ -f "servant-swagger-ui-core/configure.ac" ]; then
79+ (cd "servant-swagger-ui-core" && autoreconf -i);
80+ fi
81+ - if [ -f "servant-swagger-ui-example/configure.ac" ]; then
82+ (cd "servant-swagger-ui-example" && autoreconf -i);
83+ fi
84+ - if [ -f "servant-swagger-ui-jensoleg/configure.ac" ]; then
85+ (cd "servant-swagger-ui-jensoleg" && autoreconf -i);
86+ fi
87+ - if [ -f "servant-swagger-ui-redoc/configure.ac" ]; then
88+ (cd "servant-swagger-ui-redoc" && autoreconf -i);
7789 fi
7890 - rm -f cabal.project.freeze
7991 - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
8092 - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
81− - rm -rf .ghc.environment.* "."/dist
93+ - rm -rf .ghc.environment.* "servant-swagger-ui"/dist "servant-swagger-ui-core"/dist "servant-swagger-ui-example"/dist "servant-swagger-ui-jensoleg"/dist "servant-swagger-ui-redoc"/dist
8294 - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
8395
8496# Here starts the actual work to be performed for the package under test;
8597# any command which exits with a non-zero exit code causes the build to fail.
8698script:
8799 # test that source-distributions can be generated
88− - (cd "." && cabal sdist)
89− - mv "."/dist/servant-swagger-ui-*.tar.gz ${DISTDIR}/
100+ - (cd "servant-swagger-ui" && cabal sdist)
101+ - (cd "servant-swagger-ui-core" && cabal sdist)
102+ - (cd "servant-swagger-ui-example" && cabal sdist)
103+ - (cd "servant-swagger-ui-jensoleg" && cabal sdist)
104+ - (cd "servant-swagger-ui-redoc" && cabal sdist)
105+ - mv "servant-swagger-ui"/dist/servant-swagger-ui-*.tar.gz "servant-swagger-ui-core"/dist/servant-swagger-ui-core-*.tar.gz "servant-swagger-ui-example"/dist/servant-swagger-ui-example-*.tar.gz "servant-swagger-ui-jensoleg"/dist/servant-swagger-ui-jensoleg-*.tar.gz "servant-swagger-ui-redoc"/dist/servant-swagger-ui-redoc-*.tar.gz ${DISTDIR}/
90106 - cd ${DISTDIR} || false
91107 - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
92− - "printf 'packages: servant-swagger-ui-*/*.cabal\\n' > cabal.project"
108+ - "printf 'packages: servant-swagger-ui-*/*.cabal servant-swagger-ui-core-*/*.cabal servant-swagger-ui-example-*/*.cabal servant-swagger-ui-jensoleg-*/*.cabal servant-swagger-ui-redoc-*/*.cabal\\n' > cabal.project"
93109 - cat cabal.project
94110 # this builds all libraries and executables (without tests/benchmarks)
95111 - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
@@ -99,10 +115,13 @@ script:
99115
100116 # build & run tests, build benchmarks
101117 - cabal new-build -w ${HC} ${TEST} ${BENCH} all
102− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
103118
104119 # cabal check
105120 - (cd servant-swagger-ui-* && cabal check)
121+ - (cd servant-swagger-ui-core-* && cabal check)
122+ - (cd servant-swagger-ui-example-* && cabal check)
123+ - (cd servant-swagger-ui-jensoleg-* && cabal check)
124+ - (cd servant-swagger-ui-redoc-* && cabal check)
106125
107126 # haddock
108127 - rm -rf ./dist-newstyle
@@ -122,5 +141,5 @@ script:
122141
123142 - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80600 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.13.*' all; else echo skipping...; fi
124143
125−# REGENDATA ["--branch","master","--output",".travis.yml","--config","servant-swagger-ui.cabal"]
144+# REGENDATA ["--branch","master","--output",".travis.yml","--config","cabal.project"]
126145# EOF
cabal.projectnew file+6
@@ -0,0 +1,6 @@
1+packages:
2+ servant-swagger-ui/
3+ servant-swagger-ui-core/
4+ servant-swagger-ui-example/
5+ servant-swagger-ui-jensoleg/
6+ servant-swagger-ui-redoc/
hackage-docs.shdeleted−78
@@ -1,78 +0,0 @@
1−#!/bin/bash
2−set -e
3−
4−# This if stack-enabled fork of https://github.com/ekmett/lens/blob/master/scripts/hackage-docs.sh
5−
6−if [ "$#" -ne 1 ]; then
7− echo "Usage: scripts/hackage-docs.sh HACKAGE_USER"
8− exit 1
9−fi
10−
11−user=$1
12−
13−cabal_file=$(find . -maxdepth 1 -name "*.cabal" -print -quit)
14−if [ ! -f "$cabal_file" ]; then
15− echo "Run this script in the top-level package directory"
16− exit 1
17−fi
18−
19−pkg=$(awk -F ":[[:space:]]*" 'tolower($1)=="name" { print $2 }' < "$cabal_file")
20−ver=$(awk -F ":[[:space:]]*" 'tolower($1)=="version" { print $2 }' < "$cabal_file")
21−
22−if [ -z "$pkg" ]; then
23− echo "Unable to determine package name"
24− exit 1
25−fi
26−
27−if [ -z "$ver" ]; then
28− echo "Unable to determine package version"
29− exit 1
30−fi
31−
32−echo "Detected package: $pkg-$ver"
33−
34−dir=$(mktemp -d build-docs.XXXXXX)
35−trap 'rm -r "$dir"' EXIT
36−
37−export PATH=$(stack path --bin-path)
38−
39−ghc --version
40−cabal --version
41−stack --version
42−
43−if haddock --hyperlinked-source >/dev/null
44−then
45− echo "Using fancy hyperlinked source"
46− HYPERLINK_FLAG="--haddock-option=--hyperlinked-source"
47−else
48− echo "Using boring hyperlinked source"
49− HYPERLINK_FLAG="--hyperlink-source"
50−fi
51−
52−# Cabal dist in temporary location
53−builddir=$dir/dist
54−
55−# Build dependencies haddocks with stack, so we get links
56−stack haddock --only-dependencies
57−
58−# Configure using stack databases
59−snapshotpkgdb=$(stack path --snapshot-pkg-db)
60−localpkgdb=$(stack path --local-pkg-db)
61−cabal configure -v2 --builddir=$builddir --package-db=clear --package-db=global --package-db=$snapshotpkgdb --package-db=$localpkgdb
62−
63−# Build Hadckage compatible docs
64−cabal haddock -v2 --builddir=$builddir $HYPERLINK_FLAG --html-location='/package/$pkg-$version/docs' --contents-location='/package/$pkg-$version'
65−
66−# Copy into right directory
67−cp -R $builddir/doc/html/$pkg/ $dir/$pkg-$ver-docs
68−
69−# Tar and gzip
70−tar cvz -C $dir --format=ustar -f $dir/$pkg-$ver-docs.tar.gz $pkg-$ver-docs
71−
72−# Upload
73−curl -X PUT \
74− -H 'Content-Type: application/x-tar' \
75− -H 'Content-Encoding: gzip' \
76− -u "$user" \
77− --data-binary "@$dir/$pkg-$ver-docs.tar.gz" \
78− "https://hackage.haskell.org/package/$pkg-$ver/docs"
LICENSE → servant-swagger-ui-core/LICENSErenamed

The content is the same.

servant-swagger-ui-core/servant-swagger-ui-core.cabalnew file+57
@@ -0,0 +1,57 @@
1+cabal-version: 1.12
2+name: servant-swagger-ui-core
3+version: 0.3
4+
5+synopsis: Servant swagger ui core components
6+description:
7+ Provide embedded swagger UI for servant and swagger (i.e. servant-swagger)
8+ .
9+ See servant-swagger-ui, servant-swagger-ui-jensoleg or
10+ servant-swagger-ui-redoc for "concrete" concrete implementations.
11+category: Web, Servant, Swagger
12+homepage: https://github.com/phadej/servant-swagger-ui#readme
13+bug-reports: https://github.com/phadej/servant-swagger-ui/issues
14+author: Oleg Grenrus <oleg.grenrus@iki.fi>
15+maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
16+license: BSD3
17+license-file: LICENSE
18+tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1
19+build-type: Simple
20+
21+source-repository head
22+ type: git
23+ location: https://github.com/phadej/servant-swagger-ui
24+
25+flag servant-0-5
26+ description: Whether use servant >= 0.5
27+ manual: False
28+ default: True
29+
30+library
31+ hs-source-dirs:
32+ src
33+ ghc-options: -Wall
34+
35+ build-depends:
36+ base >=4.7 && <4.12
37+ , blaze-markup >=0.7.0.2 && <0.9
38+ , bytestring >=0.10.4.0 && <0.11
39+ , http-media >=0.6.2 && <0.8
40+ , servant >=0.4.4.5 && <0.14
41+ , servant-blaze >=0.4.4.5 && <0.9
42+ , servant-server >=0.4.4.5 && <0.14
43+ , swagger2 >=2.0.1 && <2.3
44+ , text >=1.2.0.6 && <1.3
45+ , wai-app-static >=3.0.1.1 && <3.2
46+ if flag(servant-0-5)
47+ build-depends:
48+ servant >=0.5
49+ , transformers >=0.3 && <0.6
50+ , transformers-compat >=0.3 && <0.6
51+ else
52+ build-depends:
53+ servant <0.5
54+ , either
55+ exposed-modules:
56+ Servant.Swagger.UI.Core
57+ default-language: Haskell2010
src/Servant/Swagger/UI.hs → servant-swagger-ui-core/src/Servant/Swagger/UI/Core.hsrenamed+5−76
@@ -6,16 +6,10 @@
66{-# LANGUAGE MultiParamTypeClasses #-}
77{-# LANGUAGE OverloadedStrings #-}
88{-# LANGUAGE ScopedTypeVariables #-}
9−{-# LANGUAGE TemplateHaskell #-}
109{-# LANGUAGE TypeFamilies #-}
1110{-# LANGUAGE TypeOperators #-}
1211{-# LANGUAGE UndecidableInstances #-}
1312-----------------------------------------------------------------------------
14−-- |
15−-- Module : Servant.Swagger.UI
16−-- Copyright : (C) 2016 Oleg Grenrus
17−-- License : BSD3
18−-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
1913--
2014-- Provides 'SwaggerUI' and corresponding 'swaggerUIServer' to embed
2115-- <http://swagger.io/swagger-ui/ swagger ui> into the application.
@@ -41,37 +35,19 @@
4135-- catEndpoint name = pure $ Cat name False
4236-- @
4337
44−module Servant.Swagger.UI (
38+module Servant.Swagger.UI.Core (
4539 -- * Swagger UI API
4640 SwaggerSchemaUI,
4741 SwaggerSchemaUI',
48− swaggerSchemaUIServer,
49− jensolegSwaggerSchemaUIServer,
50− redocSchemaUIServer,
5142
52− -- * Internals
53− --
54− -- /Note:/ in next major version, these will be moved to separate module.
43+ -- * Implementation details
5544 SwaggerUiHtml(..),
5645 swaggerSchemaUIServerImpl,
57− -- ** Official swagger ui
58− swaggerUiIndexTemplate,
59− swaggerUiFiles,
60− -- ** jensoleg theme
61− --
62− -- Current version: @79f3bba07b070cfab1d8c245c4f9229052e20a1a@
63− jensolegIndexTemplate,
64− jensolegFiles,
65− -- ** ReDoc theme
66− --
67− -- Current Version: v1.21.2 https://rebilly.github.io/ReDoc/releases/v1.21.2/redoc.min.js
68− redocIndexTemplate,
69− redocFiles
46+ Handler,
7047 ) where
7148
7249import Data.ByteString (ByteString)
7350import Data.Swagger (Swagger)
74−import FileEmbedLzma
7551import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)
7652import Network.Wai.Application.Static (embeddedSettings, staticApp)
7753import Servant
@@ -85,10 +61,10 @@ import qualified Data.Text as T
8561#else
8662#if MIN_VERSION_servant(0,5,0)
8763import Control.Monad.Trans.Except (ExceptT)
88−#define Handler ExceptT ServantErr IO
64+type Handler = ExceptT ServantErr IO
8965#else
9066import Control.Monad.Trans.Either (EitherT)
91−#define Handler EitherT ServantErr IO
67+type Handler = EitherT ServantErr IO
9268#endif
9369#endif
9470
@@ -144,35 +120,6 @@ instance (KnownSymbol dir, HasLink api, LINK ~ MkLink api, IsElem api api)
144120 dir = T.pack $ symbolVal (Proxy :: Proxy dir)
145121 proxyApi = Proxy :: Proxy api
146122
147−-- | Serve Swagger UI on @/dir@ using @api@ as a Swagger spec source.
148−--
149−-- @
150−-- swaggerSchemaUIServer :: Swagger -> Server (SwaggerSchemaUI schema dir)
151−-- @
152−swaggerSchemaUIServer
153− :: (Server api ~ Handler Swagger)
154− => Swagger -> Server (SwaggerSchemaUI' dir api)
155−swaggerSchemaUIServer =
156− swaggerSchemaUIServerImpl swaggerUiIndexTemplate swaggerUiFiles
157−
158−-- | Serve alternative Swagger UI.
159−--
160−-- See <https://github.com/jensoleg/swagger-ui>
161−jensolegSwaggerSchemaUIServer
162− :: (Server api ~ Handler Swagger)
163− => Swagger -> Server (SwaggerSchemaUI' dir api)
164−jensolegSwaggerSchemaUIServer =
165− swaggerSchemaUIServerImpl jensolegIndexTemplate jensolegFiles
166−
167−-- | Serve alternative Swagger UI.
168−--
169−-- See <https://github.com/Rebilly/ReDoc/tree/v1.x>
170−redocSchemaUIServer
171− :: (Server api ~ Handler Swagger)
172− => Swagger -> Server (SwaggerSchemaUI' dir api)
173−redocSchemaUIServer =
174− swaggerSchemaUIServerImpl redocIndexTemplate redocFiles
175−
176123swaggerSchemaUIServerImpl
177124 :: (Server api ~ Handler Swagger)
178125 => T.Text -> [(FilePath, ByteString)]
@@ -187,21 +134,3 @@ swaggerSchemaUIServerImpl indexTemplate files swagger = return swagger
187134 Tagged $
188135#endif
189136 staticApp $ embeddedSettings files
190−
191−swaggerUiIndexTemplate :: T.Text
192−swaggerUiIndexTemplate = $(embedText "index.html.tmpl")
193−
194−swaggerUiFiles :: [(FilePath, ByteString)]
195−swaggerUiFiles = $(embedRecursiveDir "swagger-ui-dist-3.9.1")
196−
197−jensolegIndexTemplate :: T.Text
198−jensolegIndexTemplate = $(embedText "jensoleg.index.html.tmpl")
199−
200−jensolegFiles :: [(FilePath, ByteString)]
201−jensolegFiles = $(embedRecursiveDir "jensoleg-dist")
202−
203−redocIndexTemplate :: T.Text
204−redocIndexTemplate = $(embedText "redoc.index.html.tmpl")
205−
206−redocFiles :: [(FilePath, ByteString)]
207−redocFiles = $(embedRecursiveDir "redoc-dist")
servant-swagger-ui-example/LICENSEnew file+30
@@ -0,0 +1,30 @@
1+Copyright (c) 2018, Oleg Grenrus
2+
3+All rights reserved.
4+
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
7+
8+ * Redistributions of source code must retain the above copyright
9+ notice, this list of conditions and the following disclaimer.
10+
11+ * Redistributions in binary form must reproduce the above
12+ copyright notice, this list of conditions and the following
13+ disclaimer in the documentation and/or other materials provided
14+ with the distribution.
15+
16+ * Neither the name of Oleg Grenrus nor the names of other
17+ contributors may be used to endorse or promote products derived
18+ from this software without specific prior written permission.
19+
20+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Setup.hs → servant-swagger-ui-example/Setup.hsrenamed−1
@@ -1,3 +1,2 @@
11import Distribution.Simple
2−main :: IO ()
32main = defaultMain
servant-swagger-ui-example/servant-swagger-ui-example.cabalnew file+36
@@ -0,0 +1,36 @@
1+cabal-version: 2.0
2+name: servant-swagger-ui-example
3+version: 0
4+
5+synopsis: servant-swagger-ui example
6+description:
7+ A kind of test-suite of servant-swagger-ui
8+category: Web, Servant, Swagger
9+
10+license: BSD3
11+license-file: LICENSE
12+author: Oleg Grenrus <oleg.grenrus@iki.fi>
13+maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
14+tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1
15+build-type: Simple
16+
17+executable servant-swagger-ui-example
18+ main-is: Main.hs
19+ build-depends:
20+ base >=4.7 && <4.12
21+ , servant
22+ , servant-server
23+ , servant-swagger
24+ , servant-swagger-ui
25+ , servant-swagger-ui-core
26+ , servant-swagger-ui-jensoleg
27+ , servant-swagger-ui-redoc
28+ , swagger2
29+ , text
30+ , aeson >=0.8.0.2 && <1.4
31+ , base-compat >=0.9.3 && <0.10
32+ , lens >=4.7.0.1 && <4.17
33+ , wai >=3.0.3.0 && <3.3
34+ , warp >=3.0.13.1 && <3.3
35+ hs-source-dirs: src
36+ default-language: Haskell2010
example/Main.hs → servant-swagger-ui-example/src/Main.hsrenamed+8−22
@@ -12,11 +12,11 @@
1212{-# OPTIONS_GHC -fno-warn-orphans #-}
1313module Main (main, catIsMale, catName) where
1414
15−import Prelude ()
15+import Prelude ()
1616import Prelude.Compat
1717
1818import Control.Lens hiding ((.=))
19−import Data.Aeson (ToJSON, FromJSON)
19+import Data.Aeson (FromJSON, ToJSON)
2020import Data.Maybe (fromMaybe)
2121import Data.String (IsString (..))
2222import Data.Text (Text)
@@ -29,21 +29,12 @@ import Data.Swagger
2929import Servant
3030import Servant.Swagger
3131import Servant.Swagger.UI
32+import Servant.Swagger.UI.Core
33+import Servant.Swagger.UI.JensOleG
34+import Servant.Swagger.UI.ReDoc
3235
3336import qualified Network.Wai.Handler.Warp as Warp
3437
35−#if MIN_VERSION_servant(0,7,0)
36−-- do nothing
37−#else
38−#if MIN_VERSION_servant(0,5,0)
39−import Control.Monad.Trans.Except (ExceptT)
40−#define Handler ExceptT ServantErr IO
41−#else
42−import Control.Monad.Trans.Either (EitherT)
43−#define Handler EitherT ServantErr IO
44−#endif
45−#endif
46−
4738#if MIN_VERSION_servant(0,12,0)
4839#define SUMMARY(d) Summary d :>
4940#else
@@ -217,11 +208,6 @@ main = do
217208 let uiFlavour | "jensoleg" `elem` args = JensOleG
218209 | "redoc" `elem` args = ReDoc
219210 | otherwise = Original
220− case args of
221− ("run":_) -> do
222− p <- fromMaybe 8000 . (>>= readMaybe) <$> lookupEnv "PORT"
223− putStrLn $ "http://localhost:" ++ show p ++ "/"
224− Warp.run p (app uiFlavour)
225− _ -> do
226− putStrLn "Example application, used as a compilation check"
227− putStrLn "To run, pass run argument: --test-arguments run"
211+ p <- fromMaybe 8000 . (>>= readMaybe) <$> lookupEnv "PORT"
212+ putStrLn $ "http://localhost:" ++ show p ++ "/"
213+ Warp.run p (app uiFlavour)
servant-swagger-ui-jensoleg/LICENSEnew file+45
@@ -0,0 +1,45 @@
1+Copyright (c) 2016, Oleg Grenrus
2+
3+All rights reserved.
4+
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
7+
8+ * Redistributions of source code must retain the above copyright
9+ notice, this list of conditions and the following disclaimer.
10+
11+ * Redistributions in binary form must reproduce the above
12+ copyright notice, this list of conditions and the following
13+ disclaimer in the documentation and/or other materials provided
14+ with the distribution.
15+
16+ * Neither the name of Oleg Grenrus nor the names of other
17+ contributors may be used to endorse or promote products derived
18+ from this software without specific prior written permission.
19+
20+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
32+---
33+
34+Bundled swagger-ui (index.html.tmpl original and swagger-dist-2.1.4 directory):
35+
36+Copyright 2016 SmartBear Software
37+
38+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
39+this file except in compliance with the License. You may obtain a copy of the
40+License at apache.org/licenses/LICENSE-2.0
41+
42+Unless required by applicable law or agreed to in writing, software distributed
43+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
44+CONDITIONS OF ANY KIND, either express or implied. See the License for the
45+specific language governing permissions and limitations under the License.
jensoleg-dist/css/api-explorer.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/api-explorer.cssrenamed

The content is the same.

jensoleg-dist/css/index.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/index.cssrenamed

The content is the same.

jensoleg-dist/css/print.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/print.cssrenamed

The content is the same.

jensoleg-dist/css/reset.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/reset.cssrenamed

The content is the same.

jensoleg-dist/css/screen.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/screen.cssrenamed

The content is the same.

jensoleg-dist/css/standalone.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/standalone.cssrenamed

The content is the same.

jensoleg-dist/css/typography.css → servant-swagger-ui-jensoleg/jensoleg-dist/css/typography.cssrenamed

The content is the same.

jensoleg-dist/fonts/droid-sans-v6-latin-700.eot → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.eotrenamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-700.svg → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.svgrenamed

The content is the same.

jensoleg-dist/fonts/droid-sans-v6-latin-700.ttf → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.ttfrenamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-700.woff → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.woffrenamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-700.woff2 → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-700.woff2renamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-regular.eot → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.eotrenamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-regular.svg → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.svgrenamed

The content is the same.

jensoleg-dist/fonts/droid-sans-v6-latin-regular.ttf → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.ttfrenamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.woffrenamed

Binary file not shown.

jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff2 → servant-swagger-ui-jensoleg/jensoleg-dist/fonts/droid-sans-v6-latin-regular.woff2renamed

Binary file not shown.

jensoleg-dist/images/Swagger_explorer.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/Swagger_explorer.pngrenamed

Binary file not shown.

jensoleg-dist/images/Swagger_explorer_min.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/Swagger_explorer_min.pngrenamed

Binary file not shown.

jensoleg-dist/images/explorer_icons.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/explorer_icons.pngrenamed

Binary file not shown.

jensoleg-dist/images/favicon-16x16.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/favicon-16x16.pngrenamed

Binary file not shown.

jensoleg-dist/images/favicon-32x32.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/favicon-32x32.pngrenamed

Binary file not shown.

jensoleg-dist/images/favicon.ico → servant-swagger-ui-jensoleg/jensoleg-dist/images/favicon.icorenamed

Binary file not shown.

jensoleg-dist/images/json_editor_integration.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/json_editor_integration.pngrenamed

Binary file not shown.

jensoleg-dist/images/logo_small.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/logo_small.pngrenamed

Binary file not shown.

jensoleg-dist/images/pet_store_api.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/pet_store_api.pngrenamed

Binary file not shown.

jensoleg-dist/images/senodio.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/senodio.pngrenamed

Binary file not shown.

jensoleg-dist/images/throbber.gif → servant-swagger-ui-jensoleg/jensoleg-dist/images/throbber.gifrenamed

Binary file not shown.

jensoleg-dist/images/wordnik_api.png → servant-swagger-ui-jensoleg/jensoleg-dist/images/wordnik_api.pngrenamed

Binary file not shown.

jensoleg-dist/index.html → servant-swagger-ui-jensoleg/jensoleg-dist/index.htmlrenamed

The content is the same.

jensoleg-dist/lib/backbone-min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/backbone-min.jsrenamed

The content is the same.

jensoleg-dist/lib/bootstrap.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/bootstrap.min.jsrenamed

The content is the same.

jensoleg-dist/lib/handlebars-2.0.0.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/handlebars-2.0.0.jsrenamed

The content is the same.

jensoleg-dist/lib/highlight.7.3.pack.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/highlight.7.3.pack.jsrenamed

The content is the same.

jensoleg-dist/lib/jquery-1.8.0.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery-1.8.0.min.jsrenamed

The content is the same.

jensoleg-dist/lib/jquery.ba-bbq.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery.ba-bbq.min.jsrenamed

The content is the same.

jensoleg-dist/lib/jquery.slideto.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery.slideto.min.jsrenamed

The content is the same.

jensoleg-dist/lib/jquery.wiggle.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jquery.wiggle.min.jsrenamed

The content is the same.

jensoleg-dist/lib/jsoneditor.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/jsoneditor.jsrenamed

The content is the same.

jensoleg-dist/lib/marked.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/marked.jsrenamed

The content is the same.

jensoleg-dist/lib/swagger-oauth.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/swagger-oauth.jsrenamed

The content is the same.

jensoleg-dist/lib/underscore-min.js → servant-swagger-ui-jensoleg/jensoleg-dist/lib/underscore-min.jsrenamed

The content is the same.

jensoleg-dist/moncierge.json → servant-swagger-ui-jensoleg/jensoleg-dist/moncierge.jsonrenamed

The content is the same.

jensoleg-dist/o2c.html → servant-swagger-ui-jensoleg/jensoleg-dist/o2c.htmlrenamed

The content is the same.

jensoleg-dist/petstore.json → servant-swagger-ui-jensoleg/jensoleg-dist/petstore.jsonrenamed

The content is the same.

jensoleg-dist/swagger-ui.js → servant-swagger-ui-jensoleg/jensoleg-dist/swagger-ui.jsrenamed

The content is the same.

jensoleg-dist/swagger-ui.min.js → servant-swagger-ui-jensoleg/jensoleg-dist/swagger-ui.min.jsrenamed

The content is the same.

jensoleg-dist/swagger.json → servant-swagger-ui-jensoleg/jensoleg-dist/swagger.jsonrenamed

The content is the same.

jensoleg.index.html.tmpl → servant-swagger-ui-jensoleg/jensoleg.index.html.tmplrenamed

The content is the same.

servant-swagger-ui.cabal → servant-swagger-ui-jensoleg/servant-swagger-ui-jensoleg.cabalrenamed+9−66
@@ -1,7 +1,8 @@
1−name: servant-swagger-ui
2−version: 0.2.5.3.9.1
3−x-revision: 1
4−synopsis: Servant swagger ui
1+cabal-version: 1.12
2+name: servant-swagger-ui-jensoleg
3+version: 0.3
4+
5+synopsis: Servant swagger ui: Jens-Ole Graulund theme
56description: Provide embedded swagger UI for servant and swagger (i.e. servant-swagger)
67category: Web, Servant, Swagger
78homepage: https://github.com/phadej/servant-swagger-ui#readme
@@ -12,12 +13,8 @@ license: BSD3
1213license-file: LICENSE
1314tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1
1415build-type: Simple
15−cabal-version: >= 1.10
1616
1717extra-source-files:
18− CHANGELOG.md
19− README.md
20−
2118 jensoleg.index.html.tmpl
2219 jensoleg-dist/css/api-explorer.css
2320 jensoleg-dist/css/index.css
@@ -68,80 +65,26 @@ extra-source-files:
6865 jensoleg-dist/swagger-ui.min.js
6966 jensoleg-dist/swagger.json
7067
71− redoc-dist/redoc.min.js
72− redoc.index.html.tmpl
73−
74− index.html.tmpl
75− swagger-ui-dist-3.9.1/favicon-16x16.png
76− swagger-ui-dist-3.9.1/favicon-32x32.png
77− swagger-ui-dist-3.9.1/index.html
78− swagger-ui-dist-3.9.1/oauth2-redirect.html
79− swagger-ui-dist-3.9.1/swagger-ui-bundle.js
80− swagger-ui-dist-3.9.1/swagger-ui-standalone-preset.js
81− swagger-ui-dist-3.9.1/swagger-ui.css
82− swagger-ui-dist-3.9.1/swagger-ui.js
83−
8468source-repository head
8569 type: git
8670 location: https://github.com/phadej/servant-swagger-ui
8771
88−flag servant-0-5
89− description: Whether use servant >= 0.5
90− manual: False
91− default: True
92−
9372library
9473 hs-source-dirs:
9574 src
9675 ghc-options: -Wall
9776
77+ build-depends:
78+ servant-swagger-ui-core >=0.3 && <0.4
79+
9880 build-depends:
9981 base >=4.7 && <4.12
100− , blaze-markup >=0.7.0.2 && <0.9
10182 , bytestring >=0.10.4.0 && <0.11
10283 , file-embed-lzma >=0 && <0.1
103− , http-media >=0.6.2 && <0.8
10484 , servant >=0.4.4.5 && <0.14
105− , servant-blaze >=0.4.4.5 && <0.9
10685 , servant-server >=0.4.4.5 && <0.14
107− , servant-swagger >=1.0.3 && <1.2
10886 , swagger2 >=2.0.1 && <2.3
10987 , text >=1.2.0.6 && <1.3
110− , wai-app-static >=3.0.1.1 && <3.2
111− if flag(servant-0-5)
112− build-depends:
113− servant >=0.5
114− , transformers >=0.3 && <0.6
115− , transformers-compat >=0.3 && <0.6
116− else
117− build-depends:
118− servant <0.5
119− , either
12088 exposed-modules:
121− Servant.Swagger.UI
122− default-language: Haskell2010
123−
124−test-suite example
125− type: exitcode-stdio-1.0
126− main-is: Main.hs
127− hs-source-dirs:
128− example
129− ghc-options: -Wall
130− build-depends:
131− base
132− , servant
133− , servant-server
134− , servant-swagger
135− , servant-swagger-ui
136− , swagger2
137− , text
138− , aeson >=0.8.0.2 && <1.4
139− , base-compat >=0.6.0 && <0.10
140− , lens >=4.7.0.1 && <4.17
141− , wai >=3.0.3.0 && <3.3
142− , warp >=3.0.13.1 && <3.3
143− if flag(servant-0-5)
144− build-depends: transformers, transformers-compat
145− else
146− build-depends: either
89+ Servant.Swagger.UI.JensOleG
14790 default-language: Haskell2010
servant-swagger-ui-jensoleg/src/Servant/Swagger/UI/JensOleG.hsnew file+78
@@ -0,0 +1,78 @@
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE ConstraintKinds #-}
3+{-# LANGUAGE DataKinds #-}
4+{-# LANGUAGE DeriveGeneric #-}
5+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
7+{-# LANGUAGE OverloadedStrings #-}
8+{-# LANGUAGE ScopedTypeVariables #-}
9+{-# LANGUAGE TemplateHaskell #-}
10+{-# LANGUAGE TypeFamilies #-}
11+{-# LANGUAGE TypeOperators #-}
12+{-# LANGUAGE UndecidableInstances #-}
13+-----------------------------------------------------------------------------
14+-- |
15+-- Module : Servant.Swagger.UI
16+-- Copyright : (C) 2016-2018 Oleg Grenrus
17+-- License : BSD-3-Clause
18+-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
19+--
20+-- Provides 'SwaggerUI' and corresponding 'jensolegSwaggerSchemaUIServer' to embed
21+-- <https://github.com/jensoleg/swagger-org Jens-Ole Graulund themed swagger ui> into the application.
22+--
23+-- All of the UI files are embedded into the binary.
24+--
25+-- /An example:/
26+--
27+-- @
28+-- -- | Actual API.
29+-- type BasicAPI = Get '[PlainText, JSON] Text
30+-- :\<|> "cat" :> Capture ":name" CatName :> Get '[JSON] Cat
31+--
32+-- -- | API type with bells and whistles, i.e. schema file and swagger-ui.
33+-- type API = 'SwaggerSchemaUI' "swagger-ui" "swagger.json"
34+-- :\<|> BasicAPI
35+--
36+-- -- | Servant server for an API
37+-- server :: Server API
38+-- server = 'jensolegwaggerSchemaUIServer' swaggerDoc
39+-- :\<|> (pure "Hello World" :\<|> catEndpoint)
40+-- where
41+-- catEndpoint name = pure $ Cat name False
42+-- @
43+
44+module Servant.Swagger.UI.JensOleG (
45+ -- * Swagger UI API
46+ SwaggerSchemaUI,
47+ SwaggerSchemaUI',
48+ jensolegSwaggerSchemaUIServer,
49+
50+ -- ** ReDoc theme
51+ jensolegIndexTemplate,
52+ jensolegFiles,
53+ ) where
54+
55+import Servant.Swagger.UI.Core
56+
57+import Data.ByteString (ByteString)
58+import Data.Swagger (Swagger)
59+import Data.Text (Text)
60+import FileEmbedLzma
61+import Servant
62+
63+-- | Serve alternative Swagger UI.
64+--
65+-- Current version: @79f3bba07b070cfab1d8c245c4f9229052e20a1a@
66+--
67+-- See <https://github.com/jensoleg/swagger-ui>
68+jensolegSwaggerSchemaUIServer
69+ :: (Server api ~ Handler Swagger)
70+ => Swagger -> Server (SwaggerSchemaUI' dir api)
71+jensolegSwaggerSchemaUIServer =
72+ swaggerSchemaUIServerImpl jensolegIndexTemplate jensolegFiles
73+
74+jensolegIndexTemplate :: Text
75+jensolegIndexTemplate = $(embedText "jensoleg.index.html.tmpl")
76+
77+jensolegFiles :: [(FilePath, ByteString)]
78+jensolegFiles = $(embedRecursiveDir "jensoleg-dist")
servant-swagger-ui-redoc/LICENSEnew file+45
@@ -0,0 +1,45 @@
1+Copyright (c) 2016, Oleg Grenrus
2+
3+All rights reserved.
4+
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
7+
8+ * Redistributions of source code must retain the above copyright
9+ notice, this list of conditions and the following disclaimer.
10+
11+ * Redistributions in binary form must reproduce the above
12+ copyright notice, this list of conditions and the following
13+ disclaimer in the documentation and/or other materials provided
14+ with the distribution.
15+
16+ * Neither the name of Oleg Grenrus nor the names of other
17+ contributors may be used to endorse or promote products derived
18+ from this software without specific prior written permission.
19+
20+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
32+---
33+
34+Bundled swagger-ui (index.html.tmpl original and swagger-dist-2.1.4 directory):
35+
36+Copyright 2016 SmartBear Software
37+
38+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
39+this file except in compliance with the License. You may obtain a copy of the
40+License at apache.org/licenses/LICENSE-2.0
41+
42+Unless required by applicable law or agreed to in writing, software distributed
43+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
44+CONDITIONS OF ANY KIND, either express or implied. See the License for the
45+specific language governing permissions and limitations under the License.
redoc-dist/redoc.min.js → servant-swagger-ui-redoc/redoc-dist-1.21.2/redoc.min.jsrenamed

The content is the same.

redoc.index.html.tmpl → servant-swagger-ui-redoc/redoc.index.html.tmplrenamed

The content is the same.

servant-swagger-ui-redoc/servant-swagger-ui-redoc.cabalnew file+43
@@ -0,0 +1,43 @@
1+cabal-version: 1.12
2+name: servant-swagger-ui-redoc
3+version: 0.3.0.1.21.2
4+
5+synopsis: Servant swagger ui: ReDoc theme
6+description: Provide embedded swagger UI for servant and swagger (i.e. servant-swagger)
7+category: Web, Servant, Swagger
8+homepage: https://github.com/phadej/servant-swagger-ui#readme
9+bug-reports: https://github.com/phadej/servant-swagger-ui/issues
10+author: Oleg Grenrus <oleg.grenrus@iki.fi>
11+maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
12+license: BSD3
13+license-file: LICENSE
14+tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1
15+build-type: Simple
16+
17+extra-source-files:
18+ redoc-dist-1.21.2/redoc.min.js
19+ redoc.index.html.tmpl
20+
21+source-repository head
22+ type: git
23+ location: https://github.com/phadej/servant-swagger-ui
24+
25+library
26+ hs-source-dirs:
27+ src
28+ ghc-options: -Wall
29+
30+ build-depends:
31+ servant-swagger-ui-core >=0.3 && <0.4
32+
33+ build-depends:
34+ base >=4.7 && <4.12
35+ , bytestring >=0.10.4.0 && <0.11
36+ , file-embed-lzma >=0 && <0.1
37+ , servant >=0.4.4.5 && <0.14
38+ , servant-server >=0.4.4.5 && <0.14
39+ , swagger2 >=2.0.1 && <2.3
40+ , text >=1.2.0.6 && <1.3
41+ exposed-modules:
42+ Servant.Swagger.UI.ReDoc
43+ default-language: Haskell2010
servant-swagger-ui-redoc/src/Servant/Swagger/UI/ReDoc.hsnew file+76
@@ -0,0 +1,76 @@
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE ConstraintKinds #-}
3+{-# LANGUAGE DataKinds #-}
4+{-# LANGUAGE DeriveGeneric #-}
5+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
7+{-# LANGUAGE OverloadedStrings #-}
8+{-# LANGUAGE ScopedTypeVariables #-}
9+{-# LANGUAGE TemplateHaskell #-}
10+{-# LANGUAGE TypeFamilies #-}
11+{-# LANGUAGE TypeOperators #-}
12+{-# LANGUAGE UndecidableInstances #-}
13+-----------------------------------------------------------------------------
14+-- |
15+-- Module : Servant.Swagger.UI
16+-- Copyright : (C) 2016-2018 Oleg Grenrus
17+-- License : BSD-3-Clause
18+-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
19+--
20+-- Provides 'SwaggerUI' and corresponding 'redocSchemaUIServer' to embed
21+-- <https://github.com/Rebilly/ReDoc ReDoc swagger ui> into the application.
22+--
23+-- All of the UI files are embedded into the binary.
24+--
25+-- /An example:/
26+--
27+-- @
28+-- -- | Actual API.
29+-- type BasicAPI = Get '[PlainText, JSON] Text
30+-- :\<|> "cat" :> Capture ":name" CatName :> Get '[JSON] Cat
31+--
32+-- -- | API type with bells and whistles, i.e. schema file and swagger-ui.
33+-- type API = 'SwaggerSchemaUI' "swagger-ui" "swagger.json"
34+-- :\<|> BasicAPI
35+--
36+-- -- | Servant server for an API
37+-- server :: Server API
38+-- server = 'redocSchemaUIServer' swaggerDoc
39+-- :\<|> (pure "Hello World" :\<|> catEndpoint)
40+-- where
41+-- catEndpoint name = pure $ Cat name False
42+-- @
43+
44+module Servant.Swagger.UI.ReDoc (
45+ -- * Swagger UI API
46+ SwaggerSchemaUI,
47+ SwaggerSchemaUI',
48+ redocSchemaUIServer,
49+
50+ -- ** ReDoc theme
51+ redocIndexTemplate,
52+ redocFiles
53+ ) where
54+
55+import Servant.Swagger.UI.Core
56+
57+import Data.ByteString (ByteString)
58+import Data.Swagger (Swagger)
59+import Data.Text (Text)
60+import FileEmbedLzma
61+import Servant
62+
63+-- | Serve alternative Swagger UI.
64+--
65+-- See <https://github.com/Rebilly/ReDoc/tree/v1.x>
66+redocSchemaUIServer
67+ :: (Server api ~ Handler Swagger)
68+ => Swagger -> Server (SwaggerSchemaUI' dir api)
69+redocSchemaUIServer =
70+ swaggerSchemaUIServerImpl redocIndexTemplate redocFiles
71+
72+redocIndexTemplate :: Text
73+redocIndexTemplate = $(embedText "redoc.index.html.tmpl")
74+
75+redocFiles :: [(FilePath, ByteString)]
76+redocFiles = $(embedRecursiveDir "redoc-dist-1.21.2")
CHANGELOG.md → servant-swagger-ui/CHANGELOG.mdrenamed+6
@@ -1,3 +1,9 @@
1+- 0.3.0.x.x.x
2+ - Split package into multiple packages:
3+ - [`servant-swagger-ui-core`](http://hackage.haskell.org/package/servant-swagger-ui-core)
4+ - [`servant-swagger-ui-redoc`](http://hackage.haskell.org/package/servant-swagger-ui-redoc)
5+ - [`servant-swagger-ui-jensoleg`](http://hackage.haskell.org/package/servant-swagger-ui-jensoleg)
6+
17- 0.2.5.3.9.1
28 - Support `servant-0.13`
39 - Update to `swagger-ui-3.9.1`
servant-swagger-ui/LICENSEnew file+45
@@ -0,0 +1,45 @@
1+Copyright (c) 2016, Oleg Grenrus
2+
3+All rights reserved.
4+
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
7+
8+ * Redistributions of source code must retain the above copyright
9+ notice, this list of conditions and the following disclaimer.
10+
11+ * Redistributions in binary form must reproduce the above
12+ copyright notice, this list of conditions and the following
13+ disclaimer in the documentation and/or other materials provided
14+ with the distribution.
15+
16+ * Neither the name of Oleg Grenrus nor the names of other
17+ contributors may be used to endorse or promote products derived
18+ from this software without specific prior written permission.
19+
20+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
32+---
33+
34+Bundled swagger-ui (index.html.tmpl original and swagger-dist-2.1.4 directory):
35+
36+Copyright 2016 SmartBear Software
37+
38+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
39+this file except in compliance with the License. You may obtain a copy of the
40+License at apache.org/licenses/LICENSE-2.0
41+
42+Unless required by applicable law or agreed to in writing, software distributed
43+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
44+CONDITIONS OF ANY KIND, either express or implied. See the License for the
45+specific language governing permissions and limitations under the License.
index.html.tmpl → servant-swagger-ui/index.html.tmplrenamed

The content is the same.

servant-swagger-ui/servant-swagger-ui.cabalnew file+50
@@ -0,0 +1,50 @@
1+cabal-version: 1.12
2+name: servant-swagger-ui
3+version: 0.3.0.3.9.1
4+
5+synopsis: Servant swagger ui
6+description: Provide embedded swagger UI for servant and swagger (i.e. servant-swagger)
7+category: Web, Servant, Swagger
8+homepage: https://github.com/phadej/servant-swagger-ui#readme
9+bug-reports: https://github.com/phadej/servant-swagger-ui/issues
10+author: Oleg Grenrus <oleg.grenrus@iki.fi>
11+maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
12+license: BSD3
13+license-file: LICENSE
14+tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1
15+build-type: Simple
16+
17+extra-source-files:
18+ CHANGELOG.md
19+
20+ index.html.tmpl
21+ swagger-ui-dist-3.9.1/favicon-16x16.png
22+ swagger-ui-dist-3.9.1/favicon-32x32.png
23+ swagger-ui-dist-3.9.1/swagger-ui-bundle.js
24+ swagger-ui-dist-3.9.1/swagger-ui-standalone-preset.js
25+ swagger-ui-dist-3.9.1/swagger-ui.css
26+ swagger-ui-dist-3.9.1/swagger-ui.js
27+
28+source-repository head
29+ type: git
30+ location: https://github.com/phadej/servant-swagger-ui
31+
32+library
33+ hs-source-dirs:
34+ src
35+ ghc-options: -Wall
36+
37+ build-depends:
38+ servant-swagger-ui-core >=0.3 && <0.4
39+
40+ build-depends:
41+ base >=4.7 && <4.12
42+ , bytestring >=0.10.4.0 && <0.11
43+ , file-embed-lzma >=0 && <0.1
44+ , servant >=0.4.4.5 && <0.14
45+ , servant-server >=0.4.4.5 && <0.14
46+ , swagger2 >=2.0.1 && <2.3
47+ , text >=1.2.0.6 && <1.3
48+ exposed-modules:
49+ Servant.Swagger.UI
50+ default-language: Haskell2010
servant-swagger-ui/src/Servant/Swagger/UI.hsnew file+78
@@ -0,0 +1,78 @@
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE ConstraintKinds #-}
3+{-# LANGUAGE DataKinds #-}
4+{-# LANGUAGE DeriveGeneric #-}
5+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
7+{-# LANGUAGE OverloadedStrings #-}
8+{-# LANGUAGE ScopedTypeVariables #-}
9+{-# LANGUAGE TemplateHaskell #-}
10+{-# LANGUAGE TypeFamilies #-}
11+{-# LANGUAGE TypeOperators #-}
12+{-# LANGUAGE UndecidableInstances #-}
13+-----------------------------------------------------------------------------
14+-- |
15+-- Module : Servant.Swagger.UI
16+-- Copyright : (C) 2016-2018 Oleg Grenrus
17+-- License : BSD-3-Clause
18+-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
19+--
20+-- Provides 'SwaggerUI' and corresponding 'swaggerSchemaUIServer' to embed
21+-- <http://swagger.io/swagger-ui/ swagger ui> into the application.
22+--
23+-- All of the UI files are embedded into the binary.
24+--
25+-- /An example:/
26+--
27+-- @
28+-- -- | Actual API.
29+-- type BasicAPI = Get '[PlainText, JSON] Text
30+-- :\<|> "cat" :> Capture ":name" CatName :> Get '[JSON] Cat
31+--
32+-- -- | API type with bells and whistles, i.e. schema file and swagger-ui.
33+-- type API = 'SwaggerSchemaUI' "swagger-ui" "swagger.json"
34+-- :\<|> BasicAPI
35+--
36+-- -- | Servant server for an API
37+-- server :: Server API
38+-- server = 'swaggerSchemaUIServer' swaggerDoc
39+-- :\<|> (pure "Hello World" :\<|> catEndpoint)
40+-- where
41+-- catEndpoint name = pure $ Cat name False
42+-- @
43+
44+module Servant.Swagger.UI (
45+ -- * Swagger UI API
46+ SwaggerSchemaUI,
47+ SwaggerSchemaUI',
48+ swaggerSchemaUIServer,
49+
50+ -- ** Official swagger ui
51+ swaggerUiIndexTemplate,
52+ swaggerUiFiles,
53+ ) where
54+
55+import Servant.Swagger.UI.Core
56+
57+import Data.ByteString (ByteString)
58+import Data.Swagger (Swagger)
59+import Data.Text (Text)
60+import FileEmbedLzma
61+import Servant
62+
63+-- | Serve Swagger UI on @/dir@ using @api@ as a Swagger spec source.
64+--
65+-- @
66+-- swaggerSchemaUIServer :: Swagger -> Server (SwaggerSchemaUI schema dir)
67+-- @
68+swaggerSchemaUIServer
69+ :: (Server api ~ Handler Swagger)
70+ => Swagger -> Server (SwaggerSchemaUI' dir api)
71+swaggerSchemaUIServer =
72+ swaggerSchemaUIServerImpl swaggerUiIndexTemplate swaggerUiFiles
73+
74+swaggerUiIndexTemplate :: Text
75+swaggerUiIndexTemplate = $(embedText "index.html.tmpl")
76+
77+swaggerUiFiles :: [(FilePath, ByteString)]
78+swaggerUiFiles = $(embedRecursiveDir "swagger-ui-dist-3.9.1")
swagger-ui-dist-3.9.1/favicon-16x16.png → servant-swagger-ui/swagger-ui-dist-3.9.1/favicon-16x16.pngrenamed

Binary file not shown.

swagger-ui-dist-3.9.1/favicon-32x32.png → servant-swagger-ui/swagger-ui-dist-3.9.1/favicon-32x32.pngrenamed

Binary file not shown.

swagger-ui-dist-3.9.1/swagger-ui-bundle.js → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui-bundle.jsrenamed

The content is the same.

swagger-ui-dist-3.9.1/swagger-ui-standalone-preset.js → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui-standalone-preset.jsrenamed

The content is the same.

swagger-ui-dist-3.9.1/swagger-ui.css → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui.cssrenamed

The content is the same.

swagger-ui-dist-3.9.1/swagger-ui.js → servant-swagger-ui/swagger-ui-dist-3.9.1/swagger-ui.jsrenamed

The content is the same.

swagger-ui-dist-3.9.1/index.htmldeleted−95
@@ -1,95 +0,0 @@
1−<!-- HTML for static distribution bundle build -->
2−<!DOCTYPE html>
3−<html lang="en">
4−<head>
5− <meta charset="UTF-8">
6− <title>Swagger UI</title>
7− <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
8− <link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
9− <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
10− <link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
11− <style>
12− html
13− {
14− box-sizing: border-box;
15− overflow: -moz-scrollbars-vertical;
16− overflow-y: scroll;
17− }
18− *,
19− *:before,
20− *:after
21− {
22− box-sizing: inherit;
23− }
24−
25− body {
26− margin:0;
27− background: #fafafa;
28− }
29− </style>
30−</head>
31−
32−<body>
33−
34−<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
35− <defs>
36− <symbol viewBox="0 0 20 20" id="unlocked">
37− <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
38− </symbol>
39−
40− <symbol viewBox="0 0 20 20" id="locked">
41− <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
42− </symbol>
43−
44− <symbol viewBox="0 0 20 20" id="close">
45− <path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
46− </symbol>
47−
48− <symbol viewBox="0 0 20 20" id="large-arrow">
49− <path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
50− </symbol>
51−
52− <symbol viewBox="0 0 20 20" id="large-arrow-down">
53− <path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
54− </symbol>
55−
56−
57− <symbol viewBox="0 0 24 24" id="jump-to">
58− <path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
59− </symbol>
60−
61− <symbol viewBox="0 0 24 24" id="expand">
62− <path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
63− </symbol>
64−
65− </defs>
66−</svg>
67−
68−<div id="swagger-ui"></div>
69−
70−<script src="./swagger-ui-bundle.js"> </script>
71−<script src="./swagger-ui-standalone-preset.js"> </script>
72−<script>
73−window.onload = function() {
74−
75− // Build a system
76− const ui = SwaggerUIBundle({
77− url: "http://petstore.swagger.io/v2/swagger.json",
78− dom_id: '#swagger-ui',
79− deepLinking: true,
80− presets: [
81− SwaggerUIBundle.presets.apis,
82− SwaggerUIStandalonePreset
83− ],
84− plugins: [
85− SwaggerUIBundle.plugins.DownloadUrl
86− ],
87− layout: "StandaloneLayout"
88− })
89−
90− window.ui = ui
91−}
92−</script>
93−</body>
94−
95−</html>
swagger-ui-dist-3.9.1/oauth2-redirect.htmldeleted−60
@@ -1,60 +0,0 @@
1−<!doctype html>
2−<html lang="en-US">
3−<body onload="run()">
4−</body>
5−</html>
6−<script>
7− 'use strict';
8− function run () {
9− var oauth2 = window.opener.swaggerUIRedirectOauth2;
10− var sentState = oauth2.state;
11− var redirectUrl = oauth2.redirectUrl;
12− var isValid, qp, arr;
13−
14− if (/code|token|error/.test(window.location.hash)) {
15− qp = window.location.hash.substring(1);
16− } else {
17− qp = location.search.substring(1);
18− }
19−
20− arr = qp.split("&")
21− arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
22− qp = qp ? JSON.parse('{' + arr.join() + '}',
23− function (key, value) {
24− return key === "" ? value : decodeURIComponent(value)
25− }
26− ) : {}
27−
28− isValid = qp.state === sentState
29−
30− if ((
31− oauth2.auth.schema.get("flow") === "accessCode"||
32− oauth2.auth.schema.get("flow") === "authorizationCode"
33− ) && !oauth2.auth.code) {
34− if (!isValid) {
35− oauth2.errCb({
36− authId: oauth2.auth.name,
37− source: "auth",
38− level: "warning",
39− message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
40− });
41− }
42−
43− if (qp.code) {
44− delete oauth2.state;
45− oauth2.auth.code = qp.code;
46− oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
47− } else {
48− oauth2.errCb({
49− authId: oauth2.auth.name,
50− source: "auth",
51− level: "error",
52− message: "Authorization failed: no accessCode received from the server"
53− });
54− }
55− } else {
56− oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
57− }
58− window.close();
59− }
60−</script>