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+
16# Listing alternative responses and exceptions in your API types
27
38Servant 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
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!
352353instance {-# OVERLAPPING #-}
353354 ( RunClient m ,
354355 contentTypes ~ (contentType ': otherContentTypes ),
Original file line number Diff line number Diff 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).
177176performWithStreamingRequest :: Request -> (StreamingResponse -> IO a ) -> ClientM a
178177performWithStreamingRequest req k = do
179178 ClientEnv m burl cookieJar' createClientRequest _ <- ask
Original file line number Diff line number Diff line change 1515{-# OPTIONS_GHC -Wno-orphans #-}
1616{-# OPTIONS_GHC -Wno-redundant-constraints #-}
1717
18+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
1819module Servant.Server.UVerb
1920 ( respond ,
2021 IsServerResource ,
@@ -73,6 +74,7 @@ encodeResource request cts res = (statusOf (Proxy @a),
7374
7475type IsServerResourceWithStatus cts = IsServerResource cts `And ` HasStatus
7576
77+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
7678instance
7779 ( ReflectMethod method ,
7880 AllMime contentTypes ,
Original file line number Diff line number Diff line change @@ -184,10 +184,11 @@ instance SwaggerMethod 'OPTIONS where swaggerMethod _ = options
184184instance SwaggerMethod 'HEAD where swaggerMethod _ = head_
185185instance SwaggerMethod 'PATCH where swaggerMethod _ = patch
186186
187+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
187188instance HasSwagger (UVerb method cs '[] ) where
188189 toSwagger _ = mempty
189190
190- -- | @since <TODO>
191+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
191192instance
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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ class FragmentUnique api => AtMostOneFragment api
275275
276276instance AtMostOneFragment (Verb m s ct typ )
277277
278+ -- | WARNING: UVerb is deprecated. Please use MultiVerb instead!
278279instance AtMostOneFragment (UVerb m cts as )
279280
280281instance AtMostOneFragment (Fragment a )
Original file line number Diff line number Diff line change 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
9193instance 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.
10499data UVerb (method :: StdMethod ) (contentTypes :: [Type ]) (as :: [Type ])
105100
106101instance {-# 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
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!
604604instance HasLink (UVerb m ct a ) where
605605 type MkLink (UVerb m ct a ) r = r
606606 toLink toA _ = toA
You can’t perform that action at this time.
0 commit comments