Merge pull request #1357 from SupercedeTech/master

servant-docs: Add support of Pretty modifier for all verbs aliases
This commit is contained in:
Caroline GAUDREAU 2021-11-17 14:42:24 +01:00 committed by GitHub
commit 04e4de5260
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View file

@ -32,9 +32,7 @@ import Data.ByteString.Lazy.Char8
(ByteString) (ByteString)
import qualified Data.CaseInsensitive as CI import qualified Data.CaseInsensitive as CI
import Data.Foldable import Data.Foldable
(toList) (fold, toList)
import Data.Foldable
(fold)
import Data.Hashable import Data.Hashable
(Hashable) (Hashable)
import Data.HashMap.Strict import Data.HashMap.Strict

View file

@ -18,6 +18,7 @@ import Data.Proxy
import Network.HTTP.Media import Network.HTTP.Media
((//)) ((//))
import Servant.API import Servant.API
import Servant.API.Verbs
-- | PrettyJSON content type. -- | PrettyJSON content type.
data PrettyJSON data PrettyJSON
@ -46,6 +47,24 @@ type family Pretty (api :: k) :: k where
Pretty (Put cs r) = Put (Pretty cs) r Pretty (Put cs r) = Put (Pretty cs) r
Pretty (Delete cs r) = Delete (Pretty cs) r Pretty (Delete cs r) = Delete (Pretty cs) r
Pretty (Patch cs r) = Patch (Pretty cs) r Pretty (Patch cs r) = Patch (Pretty cs) r
Pretty (GetPartialContent cs r) = GetPartialContent (Pretty cs) r
Pretty (PutResetContent cs r) = PutResetContent (Pretty cs) r
Pretty (PatchResetContent cs r) = PatchResetContent (Pretty cs) r
Pretty (DeleteResetContent cs r) = DeleteResetContent (Pretty cs) r
Pretty (PostResetContent cs r) = PostResetContent (Pretty cs) r
Pretty (GetResetContent cs r) = GetResetContent (Pretty cs) r
Pretty (PutNonAuthoritative cs r) = PutNonAuthoritative (Pretty cs) r
Pretty (PatchNonAuthoritative cs r) = PatchNonAuthoritative (Pretty cs) r
Pretty (DeleteNonAuthoritative cs r) = DeleteNonAuthoritative (Pretty cs) r
Pretty (PostNonAuthoritative cs r) = PostNonAuthoritative (Pretty cs) r
Pretty (GetNonAuthoritative cs r) = GetNonAuthoritative (Pretty cs) r
Pretty (PutAccepted cs r) = PutAccepted (Pretty cs) r
Pretty (PatchAccepted cs r) = PatchAccepted (Pretty cs) r
Pretty (DeleteAccepted cs r) = DeleteAccepted (Pretty cs) r
Pretty (PostAccepted cs r) = PostAccepted (Pretty cs) r
Pretty (GetAccepted cs r) = GetAccepted (Pretty cs) r
Pretty (PutCreated cs r) = PutCreated (Pretty cs) r
Pretty (PostCreated cs r) = PostCreated (Pretty cs) r
Pretty (ReqBody cs r) = ReqBody (Pretty cs) r Pretty (ReqBody cs r) = ReqBody (Pretty cs) r
Pretty (JSON ': xs) = PrettyJSON ': xs Pretty (JSON ': xs) = PrettyJSON ': xs
Pretty (x ': xs) = x ': Pretty xs Pretty (x ': xs) = x ': Pretty xs