packages feed

servant-auth-swagger 0.2.10.0 → 0.2.10.1

raw patch · 4 files changed

+45/−18 lines, 4 filesdep ~QuickCheckdep ~basedep ~hspecPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: QuickCheck, base, hspec, lens, servant, servant-auth, servant-swagger, swagger2, text

API changes (from Hackage documentation)

+ Servant.Auth.Swagger: class HasSecurity x
+ Servant.Auth.Swagger: securityName :: HasSecurity x => Proxy x -> Text
+ Servant.Auth.Swagger: securityScheme :: HasSecurity x => Proxy x -> SecurityScheme
- Servant.Auth.Swagger: data Auth (auths :: [*]) val :: [*] -> * -> *
+ Servant.Auth.Swagger: data Auth (auths :: [Type]) val
- Servant.Auth.Swagger: data BasicAuth :: *
+ Servant.Auth.Swagger: data BasicAuth
- Servant.Auth.Swagger: data JWT :: *
+ Servant.Auth.Swagger: data JWT

Files

CHANGELOG.md view
@@ -3,14 +3,22 @@ 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).+and this project adheres to [PVP Versioning](https://pvp.haskell.org/).  ## [Unreleased] +## [0.2.10.1] - 2020-10-06++### Changed++- Support GHC 8.10 @domenkozar+- Fix build with swagger 2.5.x @domenkozar+ ## [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+- #93: Add Cookie in SwaggerSpec API by @domenkozar+- #42: Add dummy AllHasSecurity Cookie instance by @sordina
servant-auth-swagger.cabal view
@@ -1,5 +1,5 @@ name:           servant-auth-swagger-version:        0.2.10.0+version:        0.2.10.1 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,7 +15,7 @@ copyright:      (c) Julian K. Arni license:        BSD3 license-file:   LICENSE-tested-with:    GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3+tested-with:    GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1, GHC==8.10.2 build-type:     Simple cabal-version:  >= 1.10 extra-source-files:@@ -31,13 +31,13 @@   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.12-    , text-    , servant-swagger-    , swagger2 >= 2 && < 3-    , servant-    , servant-auth == 0.3.*-    , lens+      base            >= 4.10    && < 4.15+    , text            >= 1.2.3.0 && < 1.3+    , servant-swagger >= 1.1.5   && < 1.8+    , swagger2        >= 2.2.2   && < 2.7+    , servant         >= 0.13    && < 0.19+    , servant-auth    == 0.4.*+    , lens            >= 4.16.1  && < 4.20   exposed-modules:       Servant.Auth.Swagger   default-language: Haskell2010@@ -49,7 +49,7 @@       test   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-tool-depends: hspec-discover:hspec-discover+  build-tool-depends: hspec-discover:hspec-discover >= 2.5.5 && <2.8   -- dependencies with bounds inherited from the library stanza   build-depends:       base@@ -63,8 +63,8 @@   -- test dependencies   build-depends:       servant-auth-swagger-    , hspec > 2 && < 3-    , QuickCheck >= 2.8 && < 2.12+    , hspec      >= 2.5.5  && < 2.8+    , QuickCheck >= 2.11.3 && < 2.15   other-modules:       Servant.Auth.SwaggerSpec   default-language: Haskell2010
src/Servant/Auth/Swagger.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE CPP #-} module Servant.Auth.Swagger   (   -- | The purpose of this package is provide the instance for 'servant-auth'@@ -10,12 +11,18 @@     JWT   , BasicAuth   , Auth++  -- * Needed to define instances of @HasSwagger@+  , HasSecurity (..)   ) where  import Control.Lens    ((&), (<>~)) import Data.Proxy      (Proxy (Proxy)) import Data.Swagger    (ApiKeyLocation (..), ApiKeyParams (..),-                        SecurityRequirement (..), SecurityScheme (..),+                        SecurityRequirement (..), SecurityScheme (..), +#if MIN_VERSION_swagger2(2,6,0)+                        SecurityDefinitions(..),+#endif                         SecuritySchemeType (..), allOperations, security,                         securityDefinitions) import GHC.Exts        (fromList)@@ -28,11 +35,17 @@ instance (AllHasSecurity xs, HasSwagger api) => HasSwagger (Auth xs r :> api) where   toSwagger _     = toSwagger (Proxy :: Proxy api)-        & securityDefinitions <>~ fromList secs+        & securityDefinitions <>~ mkSec (fromList secs)         & allOperations.security <>~ secReqs     where       secs = securities (Proxy :: Proxy xs)       secReqs = [ SecurityRequirement (fromList [(s,[])]) | (s,_) <- secs]+      mkSec =+#if MIN_VERSION_swagger2(2,6,0)+        SecurityDefinitions+#else+        id+#endif   class HasSecurity x where
test/Servant/Auth/SwaggerSpec.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Servant.Auth.SwaggerSpec (spec) where  import Control.Lens@@ -15,7 +16,12 @@   let swag = toSwagger (Proxy :: Proxy API)    it "adds security definitions at the top level" $ do-    length (swag ^. securityDefinitions) `shouldSatisfy` (> 0)+#if MIN_VERSION_swagger2(2,6,0)+    let (SecurityDefinitions secDefs) = swag ^. securityDefinitions+#else+    let secDefs = swag ^. securityDefinitions+#endif+    length secDefs `shouldSatisfy` (> 0)    it "adds security at sub-apis" $ do     swag ^. security `shouldBe` []