Skip to content

Commit 3e360b7

Browse files
committed
Deprecate UVerb (soft version).
1 parent a6cbb9c commit 3e360b7

File tree

9 files changed

+20
-14
lines changed

9 files changed

+20
-14
lines changed

doc/cookbook/uverb/UVerb.lhs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
# WARNING: UVerb is deprecated. Please use MultiVerb instead!
4+
5+
16
# Listing alternative responses and exceptions in your API types
27

38
Servant allows you to talk about the exceptions you throw in your API

servant-client-core/src/Servant/Client/Core/HasClient.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ instance {-# OVERLAPPING #-} UnrenderResponse cts a
349349
=> UnrenderResponse cts (WithStatus n a) where
350350
unrenderResponse hs body = (map . fmap) WithStatus . unrenderResponse hs body
351351

352+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
352353
instance {-# OVERLAPPING #-}
353354
( RunClient m,
354355
contentTypes ~ (contentType ': otherContentTypes),

servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ performRequest acceptStatus req = do
173173
throwError $ mkFailureResponse burl req ourResponse
174174
return ourResponse
175175

176-
-- | TODO: support UVerb ('acceptStatus' argument, like in 'performRequest' above).
177176
performWithStreamingRequest :: Request -> (StreamingResponse -> IO a) -> ClientM a
178177
performWithStreamingRequest req k = do
179178
ClientEnv m burl cookieJar' createClientRequest _ <- ask

servant-server/src/Servant/Server/UVerb.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
{-# OPTIONS_GHC -Wno-orphans #-}
1616
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
1717

18+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
1819
module Servant.Server.UVerb
1920
( respond,
2021
IsServerResource,
@@ -73,6 +74,7 @@ encodeResource request cts res = (statusOf (Proxy @a),
7374

7475
type IsServerResourceWithStatus cts = IsServerResource cts `And` HasStatus
7576

77+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
7678
instance
7779
( ReflectMethod method,
7880
AllMime contentTypes,

servant-swagger/src/Servant/Swagger/Internal.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,11 @@ instance SwaggerMethod 'OPTIONS where swaggerMethod _ = options
184184
instance SwaggerMethod 'HEAD where swaggerMethod _ = head_
185185
instance SwaggerMethod 'PATCH where swaggerMethod _ = patch
186186

187+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
187188
instance HasSwagger (UVerb method cs '[]) where
188189
toSwagger _ = mempty
189190

190-
-- | @since <TODO>
191+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
191192
instance
192193
{-# OVERLAPPABLE #-}
193194
( ToSchema a,
@@ -202,6 +203,8 @@ instance
202203
toSwagger (Proxy :: Proxy (Verb method (StatusOf a) cs a))
203204
`combineSwagger` toSwagger (Proxy :: Proxy (UVerb method cs as))
204205

206+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
207+
--
205208
-- ATTENTION: do not remove this instance!
206209
-- A similar instance above will always use the more general
207210
-- polymorphic -- HasSwagger instance and will result in a type error

servant/src/Servant/API/MultiVerb.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ type family ResponseTypes (as :: [Type]) where
223223

224224

225225
-- | '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
227227
-- 'Servant.API.UVerb.UVerb' and behaves similarly, but it has some important differences:
228228
--
229229
-- * Descriptions and statuses can be attached to individual responses without

servant/src/Servant/API/TypeLevel.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ class FragmentUnique api => AtMostOneFragment api
275275

276276
instance AtMostOneFragment (Verb m s ct typ)
277277

278+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
278279
instance AtMostOneFragment (UVerb m cts as)
279280

280281
instance AtMostOneFragment (Fragment a)

servant/src/Servant/API/UVerb.hs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
{-# LANGUAGE UndecidableInstances #-}
1313

1414

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
1618
-- open union of types, and specific status codes for each type in this union. (`UVerb` is
1719
-- short for `UnionVerb`)
1820
--
@@ -91,16 +93,9 @@ instance KnownStatus n => HasStatus (WithStatus n a) where
9193
instance HasStatus a => HasStatus (Headers ls a) where
9294
type StatusOf (Headers ls a) = StatusOf a
9395

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!
10197
--
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.
10499
data UVerb (method :: StdMethod) (contentTypes :: [Type]) (as :: [Type])
105100

106101
instance {-# OVERLAPPING #-} MimeRender JSON a => MimeRender JSON (WithStatus _status a) where

servant/src/Servant/Links.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ instance HasLink (Stream m status fr ct a) where
600600
type MkLink (Stream m status fr ct a) r = r
601601
toLink toA _ = toA
602602

603-
-- UVerb instances
603+
-- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
604604
instance HasLink (UVerb m ct a) where
605605
type MkLink (UVerb m ct a) r = r
606606
toLink toA _ = toA

0 commit comments

Comments
 (0)