File tree Expand file tree Collapse file tree 9 files changed +20
-14
lines changed
servant-client-core/src/Servant/Client/Core
servant-client/src/Servant/Client/Internal/HttpClient
servant-server/src/Servant/Server
servant-swagger/src/Servant/Swagger Expand file tree Collapse file tree 9 files changed +20
-14
lines changed Original file line number Diff line number Diff line change
1
+
2
+
3
+ # WARNING: UVerb is deprecated. Please use MultiVerb instead!
4
+
5
+
1
6
# Listing alternative responses and exceptions in your API types
2
7
3
8
Servant allows you to talk about the exceptions you throw in your API
Original file line number Diff line number Diff line change @@ -349,6 +349,7 @@ instance {-# OVERLAPPING #-} UnrenderResponse cts a
349
349
=> UnrenderResponse cts (WithStatus n a ) where
350
350
unrenderResponse hs body = (map . fmap ) WithStatus . unrenderResponse hs body
351
351
352
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
352
353
instance {-# OVERLAPPING #-}
353
354
( RunClient m ,
354
355
contentTypes ~ (contentType ': otherContentTypes ),
Original file line number Diff line number Diff line change @@ -173,7 +173,6 @@ performRequest acceptStatus req = do
173
173
throwError $ mkFailureResponse burl req ourResponse
174
174
return ourResponse
175
175
176
- -- | TODO: support UVerb ('acceptStatus' argument, like in 'performRequest' above).
177
176
performWithStreamingRequest :: Request -> (StreamingResponse -> IO a ) -> ClientM a
178
177
performWithStreamingRequest req k = do
179
178
ClientEnv m burl cookieJar' createClientRequest _ <- ask
Original file line number Diff line number Diff line change 15
15
{-# OPTIONS_GHC -Wno-orphans #-}
16
16
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
17
17
18
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
18
19
module Servant.Server.UVerb
19
20
( respond ,
20
21
IsServerResource ,
@@ -73,6 +74,7 @@ encodeResource request cts res = (statusOf (Proxy @a),
73
74
74
75
type IsServerResourceWithStatus cts = IsServerResource cts `And ` HasStatus
75
76
77
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
76
78
instance
77
79
( ReflectMethod method ,
78
80
AllMime contentTypes ,
Original file line number Diff line number Diff line change @@ -184,10 +184,11 @@ instance SwaggerMethod 'OPTIONS where swaggerMethod _ = options
184
184
instance SwaggerMethod 'HEAD where swaggerMethod _ = head_
185
185
instance SwaggerMethod 'PATCH where swaggerMethod _ = patch
186
186
187
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
187
188
instance HasSwagger (UVerb method cs '[] ) where
188
189
toSwagger _ = mempty
189
190
190
- -- | @since <TODO>
191
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
191
192
instance
192
193
{-# OVERLAPPABLE #-}
193
194
( ToSchema a ,
@@ -202,6 +203,8 @@ instance
202
203
toSwagger (Proxy :: Proxy (Verb method (StatusOf a ) cs a ))
203
204
`combineSwagger` toSwagger (Proxy :: Proxy (UVerb method cs as ))
204
205
206
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
207
+ --
205
208
-- ATTENTION: do not remove this instance!
206
209
-- A similar instance above will always use the more general
207
210
-- polymorphic -- HasSwagger instance and will result in a type error
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ type family ResponseTypes (as :: [Type]) where
223
223
224
224
225
225
-- | 'MultiVerb' produces an endpoint which can return
226
- -- multiple values with various content types and status codes. It is similar to
226
+ -- multiple values with various content types and status codes. It is similar to the deprecated
227
227
-- 'Servant.API.UVerb.UVerb' and behaves similarly, but it has some important differences:
228
228
--
229
229
-- * Descriptions and statuses can be attached to individual responses without
Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ class FragmentUnique api => AtMostOneFragment api
275
275
276
276
instance AtMostOneFragment (Verb m s ct typ )
277
277
278
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
278
279
instance AtMostOneFragment (UVerb m cts as )
279
280
280
281
instance AtMostOneFragment (Fragment a )
Original file line number Diff line number Diff line change 12
12
{-# LANGUAGE UndecidableInstances #-}
13
13
14
14
15
- -- | An alternative to 'Verb' for end-points that respond with a resource value of any of an
15
+ -- | **WARNING: UVerb is deprecated. Please use MultiVerb instead!**
16
+ --
17
+ -- An alternative to 'Verb' for end-points that respond with a resource value of any of an
16
18
-- open union of types, and specific status codes for each type in this union. (`UVerb` is
17
19
-- short for `UnionVerb`)
18
20
--
@@ -91,16 +93,9 @@ instance KnownStatus n => HasStatus (WithStatus n a) where
91
93
instance HasStatus a => HasStatus (Headers ls a ) where
92
94
type StatusOf (Headers ls a ) = StatusOf a
93
95
94
- -- | A variant of 'Verb' that can have any of a number of response values and status codes.
95
- --
96
- -- FUTUREWORK: it would be nice to make 'Verb' a special case of 'UVerb', and only write
97
- -- instances for 'HasServer' etc. for the latter, getting them for the former for free.
98
- -- Something like:
99
- --
100
- -- @type Verb method statusCode contentTypes a = UVerb method contentTypes [WithStatus statusCode a]@
96
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
101
97
--
102
- -- Backwards compatibility is tricky, though: this type alias would mean people would have to
103
- -- use 'respond' instead of 'pure' or 'return', so all old handlers would have to be rewritten.
98
+ -- A variant of 'Verb' that can have any of a number of response values and status codes.
104
99
data UVerb (method :: StdMethod ) (contentTypes :: [Type ]) (as :: [Type ])
105
100
106
101
instance {-# OVERLAPPING #-} MimeRender JSON a => MimeRender JSON (WithStatus _status a ) where
Original file line number Diff line number Diff line change @@ -600,7 +600,7 @@ instance HasLink (Stream m status fr ct a) where
600
600
type MkLink (Stream m status fr ct a ) r = r
601
601
toLink toA _ = toA
602
602
603
- -- UVerb instances
603
+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
604
604
instance HasLink (UVerb m ct a ) where
605
605
type MkLink (UVerb m ct a ) r = r
606
606
toLink toA _ = toA
You can’t perform that action at this time.
0 commit comments