Skip to content

Commit d0469df

Browse files
committed
monomorphise ToSchema (Paginated _)
1 parent 7a9e954 commit d0469df

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

primer-service/src/Primer/Pagination.hs

+11-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ module Primer.Pagination (
2828

2929
import Foreword
3030

31+
import Primer.OpenAPI ()
3132
import Data.Aeson (ToJSON)
3233
import Data.OpenApi (ToParamSchema, ToSchema, declareNamedSchema, toParamSchema)
3334
import Data.OpenApi.Internal.Schema (plain)
3435
import Optics ((?~))
3536
import Primer.Database (
3637
OffsetLimit (OL, limit, offset),
37-
Page (Page, pageContents, total),
38+
Page (Page, pageContents, total), Session,
3839
)
3940
import Servant (
4041
DefaultErrorFormatters,
@@ -48,6 +49,7 @@ import Servant (
4849
type (.++),
4950
)
5051
import Servant.OpenApi (HasOpenApi (toOpenApi))
52+
import GHC.Base (String)
5153

5254
-- | Guarantees its contents is strictly positive.
5355
-- @getPositive x > 0@ is always true (because the only way to create one is
@@ -109,8 +111,14 @@ data Paginated a = Paginated
109111
}
110112
deriving (Generic, Show)
111113

112-
instance ToJSON a => ToJSON (Paginated a)
113-
instance ToSchema a => ToSchema (Paginated a)
114+
instance ToJSON (Paginated Session)
115+
instance ToSchema (Paginated Session)
116+
instance ToJSON (Paginated String)
117+
instance ToSchema (Paginated String)
118+
instance ToJSON (Paginated Text)
119+
instance ToSchema (Paginated Text)
120+
instance ToJSON (Paginated Char)
121+
instance ToSchema (Paginated Char)
114122

115123
-- Used solely for nice bounds in schema
116124
newtype NonNeg = NonNeg Int

0 commit comments

Comments
 (0)