servant-swagger 1.1.7.1 → 1.1.8
raw patch · 5 files changed
+41/−11 lines, 5 filesdep ~servantPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: servant
API changes (from Hackage documentation)
+ Servant.Swagger.Internal: instance forall k1 (method :: k1). Servant.Swagger.Internal.SwaggerMethod method => Servant.Swagger.Internal.HasSwagger (Servant.API.Verbs.NoContentVerb method)
+ Servant.Swagger.Internal: mkEndpointNoContentVerb :: forall proxy method. SwaggerMethod method => FilePath -> proxy (NoContentVerb method) -> Swagger
Files
- CHANGELOG.md +5/−0
- servant-swagger.cabal +10/−9
- src/Servant/Swagger/Internal.hs +16/−0
- src/Servant/Swagger/Internal/Test.hs +5/−2
- src/Servant/Swagger/Internal/TypeLevel/API.hs +5/−0
CHANGELOG.md view
@@ -1,3 +1,8 @@+1.1.8+-------++* Support `servant-0.17`+ 1.1.7.1 -------
servant-swagger.cabal view
@@ -1,5 +1,5 @@ name: servant-swagger-version: 1.1.7.1+version: 1.1.8 synopsis: Generate a Swagger/OpenAPI/OAS 2.0 specification for your servant API. description: Swagger is a project used to describe and document RESTful APIs. The core of the @@ -33,6 +33,7 @@ || ==8.2.2 || ==8.4.4 || ==8.6.5+ || ==8.8.1 extra-source-files: README.md@@ -53,8 +54,8 @@ custom-setup setup-depends:- base >=4.9 && <4.13,- Cabal >= 1.24 && <2.5,+ base >=4.9 && <4.14,+ Cabal >= 1.24 && <3.1, cabal-doctest >=1.0.6 && <1.1 library@@ -75,15 +76,15 @@ hs-source-dirs: src build-depends: aeson >=1.4.2.0 && <1.5 , aeson-pretty >=0.8.7 && <0.9- , base >=4.9.1.0 && <4.13- , base-compat >=0.10.5 && <0.11+ , base >=4.9.1.0 && <4.14+ , base-compat >=0.10.5 && <0.12 , bytestring >=0.10.8.1 && <0.11 , http-media >=0.7.1.3 && <0.9 , insert-ordered-containers >=0.2.1.0 && <0.3- , lens >=4.17 && <4.18- , servant >=0.15 && <0.17+ , lens >=4.17 && <4.19+ , servant >=0.17 && <0.18 , singleton-bool >=0.1.4 && <0.2- , swagger2 >=2.3.0.1 && <2.5+ , swagger2 >=2.3.0.1 && <2.6 , text >=1.2.3.0 && <1.3 , unordered-containers >=0.2.9.0 && <0.3 @@ -117,7 +118,7 @@ , hspec >=2.6.0 && <2.8 , QuickCheck , lens- , lens-aeson >=1.0.2 && <1.1+ , lens-aeson >=1.0.2 && <1.2 , servant , servant-swagger , swagger2
src/Servant/Swagger/Internal.hs view
@@ -130,6 +130,19 @@ responseContentTypes = allContentType (Proxy :: Proxy cs) responseHeaders = toAllResponseHeaders (Proxy :: Proxy hs) +mkEndpointNoContentVerb :: forall proxy method.+ (SwaggerMethod method)+ => FilePath -- ^ Endpoint path.+ -> proxy (NoContentVerb method) -- ^ Method+ -> Swagger+mkEndpointNoContentVerb path _ = mempty+ & paths.at path ?~+ (mempty & method ?~ (mempty+ & at code ?~ Inline mempty))+ where+ method = swaggerMethod (Proxy :: Proxy method)+ code = 204 -- hardcoded in servant-server+ -- | Add parameter to every operation in the spec. addParam :: Param -> Swagger -> Swagger addParam param = allOperations.parameters %~ (Inline param :)@@ -191,6 +204,9 @@ instance (AllAccept cs, AllToResponseHeader hs, KnownNat status, SwaggerMethod method) => HasSwagger (Verb method status cs (Headers hs NoContent)) where toSwagger = mkEndpointNoContent "/"++instance (SwaggerMethod method) => HasSwagger (NoContentVerb method) where+ toSwagger = mkEndpointNoContentVerb "/" instance (HasSwagger a, HasSwagger b) => HasSwagger (a :<|> b) where toSwagger _ = toSwagger (Proxy :: Proxy a) <> toSwagger (Proxy :: Proxy b)
src/Servant/Swagger/Internal/Test.hs view
@@ -77,8 +77,11 @@ -- ...No instance for (Arbitrary Contact) -- ... arising from a use of ‘validateEveryToJSON’ -- ...-validateEveryToJSON :: forall proxy api. TMap (Every [Typeable, Show, Arbitrary, ToJSON, ToSchema]) (BodyTypes JSON api) =>- proxy api -- ^ Servant API.+validateEveryToJSON+ :: forall proxy api .+ TMap (Every [Typeable, Show, Arbitrary, ToJSON, ToSchema])+ (BodyTypes JSON api)+ => proxy api -- ^ Servant API. -> Spec validateEveryToJSON _ = props (Proxy :: Proxy [ToJSON, ToSchema])
src/Servant/Swagger/Internal/TypeLevel/API.hs view
@@ -72,8 +72,13 @@ -- | Extract a list of "body" types for a specific content-type from a servant API. -- To extract unique types see @'BodyTypes'@.+--+-- @'NoContent'@ is removed from the list and not tested. (This allows for leaving the body+-- completely empty on responses to requests that only accept 'application/json', while+-- setting the content-type in the response accordingly.) type family BodyTypes' c api :: [*] where BodyTypes' c (Verb verb b cs (Headers hdrs a)) = AddBodyType c cs a '[]+ BodyTypes' c (Verb verb b cs NoContent) = '[] BodyTypes' c (Verb verb b cs a) = AddBodyType c cs a '[] BodyTypes' c (ReqBody' mods cs a :> api) = AddBodyType c cs a (BodyTypes' c api) BodyTypes' c (e :> api) = BodyTypes' c api