-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Testing of Swagger APIs -- -- This package provides a library and executable tool that supports -- testing APIs specified with Swagger. It allows one to generate -- arbitrary Swagger requests for any given specification. @package swagger-test @version 0.1.0 -- | This module exposes some types that ure used across other modules of -- swagger-test. module Test.Swagger.Types -- | The FullyQualifiedHost contains the scheme (i.e. http://), -- hostname and port. type FullyQualifiedHost = String type Seed = Int type OperationId = Text type HttpHeader = (CI Text, Text) type Headers = [HttpHeader] data HttpRequest HttpRequest :: Maybe FullyQualifiedHost -> Method -> Text -> QueryText -> Headers -> Maybe ByteString -> HttpRequest [requestHost] :: HttpRequest -> Maybe FullyQualifiedHost [requestMethod] :: HttpRequest -> Method [requestPath] :: HttpRequest -> Text [requestQuery] :: HttpRequest -> QueryText [requestHeaders] :: HttpRequest -> Headers [requestBody] :: HttpRequest -> Maybe ByteString data HttpResponse HttpResponse :: HttpVersion -> Status -> Headers -> Maybe ByteString -> HttpResponse [responseHttpVersion] :: HttpResponse -> HttpVersion [responseStatus] :: HttpResponse -> Status [responseHeaders] :: HttpResponse -> Headers [responseBody] :: HttpResponse -> Maybe ByteString -- | Replace all references with inlines resolveReferences :: Swagger -> Swagger -- | Transform a reference into a Just value if is inline, Nothing, -- otherwise refToMaybe :: Referenced a -> Maybe a instance GHC.Show.Show Test.Swagger.Types.HttpResponse instance GHC.Show.Show Test.Swagger.Types.HttpRequest instance Data.Aeson.Types.ToJSON.ToJSON Test.Swagger.Types.HttpRequest instance Data.Aeson.Types.ToJSON.ToJSON Test.Swagger.Types.HttpResponse -- | Exposes some functions to validate responses against a Swagger schema. -- There are four functions that can be used depending whether the -- response is parsed, if the operation is available (or just the id) module Test.Swagger.Validate -- | Parse a HttpResponse from ByteString parseResponse :: ByteString -> Either String HttpResponse -- | Validate a response, from a particular operation id, (encoded in a -- byte-string) against a Swagger schema validateResponseBytes :: ByteString -> Swagger -> OperationId -> Either String () -- | Validate a response, from a particular operation against a Swagger -- schema validateResponseWithOperation :: HttpResponse -> Swagger -> Operation -> Either String () -- | Validate a response, from a particular operation id against a Swagger -- schema validateResponse :: HttpResponse -> Swagger -> OperationId -> Either String () -- | Exposes doHttpRequest, which executes the HTTP request and -- return the response. module Test.Swagger.Request -- | Executes the HTTP request and returns the HTTP response doHttpRequest :: HttpRequest -> IO HttpResponse module Test.Swagger.Print -- | Possible output formats that applies to HttpRequest and -- HttpResponse values data Format FormatHttp :: Format FormatCurl :: Format FormatNone :: Format FormatJSON :: Format -- | Valid output formats for HttpRequest values requestFormats :: [Format] -- | Valid output formats for HttpResponse values responseFormats :: [Format] -- | Print a request according to format printRequest :: Format -> HttpRequest -> IO () -- | Print a response according to format printResponse :: Format -> HttpResponse -> IO () instance GHC.Enum.Enum Test.Swagger.Print.Format instance GHC.Enum.Bounded Test.Swagger.Print.Format instance GHC.Show.Show Test.Swagger.Print.Format -- | Exposes generateRequest, which creates a random request from a -- Swagger schema. module Test.Swagger.Gen -- | Given a swagger.json schema, produce a Request that complies with the -- schema. The return type is a random Request (in the IO monad because -- it's random). generateRequest :: Seed -> Int -> Swagger -> Maybe OperationId -> (Operation, HttpRequest) -- | Re-exports module Test.Swagger