Browse Source

Update for swagger2-1.1.1

tags/v0.1
Nickolay Kudasov 6 years ago
parent
commit
86eb05c1ec
  1. 9
      src/Servant/Swagger/Internal.hs
  2. 2
      stack.yaml

9
src/Servant/Swagger/Internal.hs

@ -29,10 +29,6 @@ import GHC.Exts
import Network.HTTP.Media (MediaType)
import Servant.API
type TagName = Text
type HeaderName = Text
type HttpStatusCode = Int
class HasSwagger api where
toSwagger :: Proxy api -> Swagger
@ -250,10 +246,9 @@ instance (KnownSymbol sym, ToParamSchema a, HasSwagger sub) => HasSwagger (Query
& paramName .~ Text.pack name
& paramSchema .~ ParamOther (mempty
& paramOtherSchemaIn .~ ParamQuery
& paramOtherSchemaCollectionFormat ?~ CollectionMulti
& parameterSchema .~ (mempty
& schemaType .~ SwaggerArray
& schemaItems ?~ SwaggerItemsPrimitive (Items Nothing (toParamSchema (Proxy :: Proxy a)))))
& schemaItems ?~ SwaggerItemsPrimitive (Just CollectionMulti) (toParamSchema (Proxy :: Proxy a))))
instance (KnownSymbol sym, HasSwagger sub) => HasSwagger (QueryFlag sym :> sub) where
toSwagger _ = toSwagger (Proxy :: Proxy sub)
@ -311,7 +306,7 @@ class ToResponseHeader h where
toResponseHeader :: Proxy h -> (HeaderName, Swagger.Header)
instance (KnownSymbol sym, ToParamSchema a) => ToResponseHeader (Header sym a) where
toResponseHeader _ = (hname, Swagger.Header Nothing Nothing schema)
toResponseHeader _ = (hname, Swagger.Header Nothing schema)
where
hname = Text.pack (symbolVal (Proxy :: Proxy sym))
schema = toParamSchema (Proxy :: Proxy a)

2
stack.yaml

@ -10,7 +10,7 @@ packages:
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- swagger2-1.0
- swagger2-1.1.1
# Override default flag values for local packages and extra-deps
flags: {}

Loading…
Cancel
Save