summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordomenkozar <>2018-06-18 15:46:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-06-18 15:46:00 (GMT)
commit807a4a83bf28005b8d141fa9cba64e47a8bd4b09 (patch)
tree41404d321d251ed42c00c35145dbf5634373d1c6
parent183e86e93880cb674b15c8bfc13fb2a36b029e2f (diff)
version 0.2.10.0HEAD0.2.10.0master
-rw-r--r--CHANGELOG.md16
-rw-r--r--servant-auth-swagger.cabal8
-rw-r--r--src/Servant/Auth/Swagger.hs8
-rw-r--r--test/Servant/Auth/SwaggerSpec.hs3
4 files changed, 30 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..15212f0
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,16 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [0.2.10.0] - 2018-06-18
+
+### Added
+- Support for GHC 8.4 by @phadej
+- Changelog by @domenkozar
+- #93: add Cookie in SwaggerSpec API by @domenkozar
+- #42: add dummy AllHasSecurity Cookie instance by @sordina
diff --git a/servant-auth-swagger.cabal b/servant-auth-swagger.cabal
index 08a4c27..18da008 100644
--- a/servant-auth-swagger.cabal
+++ b/servant-auth-swagger.cabal
@@ -1,5 +1,5 @@
name: servant-auth-swagger
-version: 0.2.9.0
+version: 0.2.10.0
synopsis: servant-swagger/servant-auth compatibility
description: This package provides instances that allow generating swagger2 schemas from
<https://hackage.haskell.org/package/servant servant>
@@ -15,9 +15,11 @@ maintainer: jkarni@gmail.com
copyright: (c) Julian K. Arni
license: BSD3
license-file: LICENSE
-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2
+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3
build-type: Simple
cabal-version: >= 1.10
+extra-source-files:
+ CHANGELOG.md
source-repository head
type: git
@@ -29,7 +31,7 @@ library
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
- base >= 4.8 && < 4.11
+ base >= 4.8 && < 4.12
, text
, servant-swagger
, swagger2 >= 2 && < 3
diff --git a/src/Servant/Auth/Swagger.hs b/src/Servant/Auth/Swagger.hs
index 927f823..80f7534 100644
--- a/src/Servant/Auth/Swagger.hs
+++ b/src/Servant/Auth/Swagger.hs
@@ -56,7 +56,7 @@ instance HasSecurity JWT where
class AllHasSecurity (x :: [*]) where
securities :: Proxy x -> [(T.Text,SecurityScheme)]
-instance (HasSecurity x, AllHasSecurity xs) => AllHasSecurity (x ': xs) where
+instance {-# OVERLAPPABLE #-} (HasSecurity x, AllHasSecurity xs) => AllHasSecurity (x ': xs) where
securities _ = (securityName px, securityScheme px) : securities pxs
where
px :: Proxy x
@@ -64,5 +64,11 @@ instance (HasSecurity x, AllHasSecurity xs) => AllHasSecurity (x ': xs) where
pxs :: Proxy xs
pxs = Proxy
+instance {-# OVERLAPPING #-} AllHasSecurity xs => AllHasSecurity (Cookie ': xs) where
+ securities _ = securities pxs
+ where
+ pxs :: Proxy xs
+ pxs = Proxy
+
instance AllHasSecurity '[] where
securities _ = []
diff --git a/test/Servant/Auth/SwaggerSpec.hs b/test/Servant/Auth/SwaggerSpec.hs
index d7fa530..eaf3b9c 100644
--- a/test/Servant/Auth/SwaggerSpec.hs
+++ b/test/Servant/Auth/SwaggerSpec.hs
@@ -3,6 +3,7 @@ module Servant.Auth.SwaggerSpec (spec) where
import Control.Lens
import Data.Proxy
import Servant.API
+import Servant.Auth
import Servant.Auth.Swagger
import Data.Swagger
import Servant.Swagger
@@ -23,7 +24,7 @@ spec = describe "HasSwagger instance" $ do
-- * API
-type API = "secure" :> Auth '[JWT] Int :> SecureAPI
+type API = "secure" :> Auth '[JWT, Cookie] Int :> SecureAPI
:<|> "insecure" :> InsecureAPI
type SecureAPI = Get '[JSON] Int :<|> ReqBody '[JSON] Int :> Post '[JSON] Int