servant-auth-token-api 0.1.0.1 → 0.1.1.0
raw patch · 3 files changed
+18/−4 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Servant.API.Auth.Token.Pagination: instance (Data.Swagger.Internal.Schema.ToSchema i, Data.Swagger.Internal.Schema.ToSchema a) => Data.Swagger.Internal.Schema.ToSchema (Servant.API.Auth.Token.Pagination.PagedList i a)
+ Servant.API.Auth.Token: PagedList :: ![WithId i a] -> !Word -> PagedList i a
+ Servant.API.Auth.Token: [pagedListItems] :: PagedList i a -> ![WithId i a]
+ Servant.API.Auth.Token: [pagedListPages] :: PagedList i a -> !Word
+ Servant.API.Auth.Token: data PagedList i a
+ Servant.API.Auth.Token: type Page = Word
+ Servant.API.Auth.Token: type PageParam = QueryParam "page" Page
+ Servant.API.Auth.Token: type PageSize = Word
+ Servant.API.Auth.Token: type PageSizeParam = QueryParam "size" PageSize
+ Servant.API.Auth.Token.Pagination: instance (Data.Typeable.Internal.Typeable i, Data.Typeable.Internal.Typeable a, Data.Swagger.Internal.Schema.ToSchema i, Data.Swagger.Internal.Schema.ToSchema a) => Data.Swagger.Internal.Schema.ToSchema (Servant.API.Auth.Token.Pagination.PagedList i a)
Files
+ CHANGELOG.md view
@@ -0,0 +1,4 @@+0.1.1.0+=======++* `PagedList` schema name now contains names of parameters.
servant-auth-token-api.cabal view
@@ -1,5 +1,5 @@ name: servant-auth-token-api-version: 0.1.0.1+version: 0.1.1.0 synopsis: Servant based API for token based authorisation description: Please see README.md homepage: https://github.com/ncrashed/servant-auth-token-api#readme@@ -12,6 +12,7 @@ build-type: Simple extra-source-files: README.md+ CHANGELOG.md cabal-version: >=1.10 library
src/Servant/API/Auth/Token/Pagination.hs view
@@ -20,8 +20,12 @@ ) where import Data.Aeson.WithField +import Data.Monoid import Data.Proxy import Data.Swagger+import Data.Swagger.Internal.Schema+import Data.Text (pack)+import Data.Typeable import GHC.Generics import Servant.API import Servant.API.Auth.Token.Internal.DeriveJson @@ -52,9 +56,14 @@ } deriving (Generic, Show) $(deriveJSON (derivePrefix "pagedList") ''PagedList) -instance (ToSchema i, ToSchema a) => ToSchema (PagedList i a) where - declareNamedSchema = genericDeclareNamedSchema $- schemaOptionsDropPrefix "pagedList"+instance (Typeable i, Typeable a, ToSchema i, ToSchema a) => ToSchema (PagedList i a) where + declareNamedSchema p = do+ s <- genericDeclareNamedSchema (schemaOptionsDropPrefix "pagedList") p+ return $ rename nm s+ where + nm = Just $ "PagedList " <> iname <> " " <> aname+ iname = pack . show $ typeRep (Proxy :: Proxy i)+ aname = pack . show $ typeRep (Proxy :: Proxy a) instance (ToSample i, ToSample a) => ToSample (PagedList i a) where toSamples _ = samples $ [s $ toSamples (Proxy :: Proxy (WithId i a))]