Copyright | (c) Rodrigo Setti 2017 |
---|---|
License | BSD3 |
Maintainer | rodrigosetti@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Re-exports
- generateRequest :: Seed -> Size -> NormalizedSwagger -> Maybe OperationId -> (Operation, HttpRequest)
- data Format
- requestFormats :: [Format]
- responseFormats :: [Format]
- printRequest :: Format -> HttpRequest -> Builder
- printResponse :: Format -> HttpResponse -> Builder
- doHttpRequest :: HttpRequest -> IO HttpResponse
- type FullyQualifiedHost = String
- type Seed = Int
- type Size = Int
- data NormalizedSwagger
- getSwagger :: NormalizedSwagger -> Swagger
- type OperationId = Text
- type HttpHeader = (CI Text, Text)
- type Headers = [HttpHeader]
- data HttpRequest = HttpRequest {}
- data HttpResponse = HttpResponse {}
- refToMaybe :: Referenced a -> Maybe a
- data TestReport = TestReport {}
- isSuccessful :: TestReport -> Bool
- isFailure :: TestReport -> Bool
- writeReportFile :: FilePath -> NormalizedSwagger -> [TestReport] -> IO ()
- writeErrorReportFile :: FilePath -> String -> IO ()
- runTests :: NormalizedSwagger -> Int -> Size -> IO [TestReport]
- parseResponse :: ByteString -> Either String HttpResponse
- type ValidationResult = Either String ()
- validateResponseBytes :: ByteString -> NormalizedSwagger -> OperationId -> ValidationResult
- validateResponseWithOperation :: HttpResponse -> NormalizedSwagger -> Operation -> ValidationResult
- validateResponse :: HttpResponse -> NormalizedSwagger -> OperationId -> ValidationResult
Documentation
generateRequest :: Seed -> Size -> NormalizedSwagger -> Maybe OperationId -> (Operation, HttpRequest) Source #
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).
Possible output formats that applies to HttpRequest
and HttpResponse
values
requestFormats :: [Format] Source #
Valid output formats for HttpRequest
values
responseFormats :: [Format] Source #
Valid output formats for HttpResponse
values
printRequest :: Format -> HttpRequest -> Builder Source #
Print a request according to format
printResponse :: Format -> HttpResponse -> Builder Source #
Print a response according to format
doHttpRequest :: HttpRequest -> IO HttpResponse Source #
Executes the HTTP request and returns the HTTP response
type FullyQualifiedHost = String Source #
The FullyQualifiedHost contains the scheme (i.e. http://), hostname and port.
type OperationId = Text Source #
type Headers = [HttpHeader] Source #
refToMaybe :: Referenced a -> Maybe a Source #
Transform a reference into a Just value if is inline, Nothing, otherwise
isSuccessful :: TestReport -> Bool Source #
Predicate that tells whether or not a report is of a successful validation
isFailure :: TestReport -> Bool Source #
writeReportFile :: FilePath -> NormalizedSwagger -> [TestReport] -> IO () Source #
writeErrorReportFile :: FilePath -> String -> IO () Source #
Write a report file containing just a single error message. This is to be used if we find an error before being able to run any test (parsing schema, etc.)
runTests :: NormalizedSwagger -> Int -> Size -> IO [TestReport] Source #
Run n tests for a Swagger
schema
parseResponse :: ByteString -> Either String HttpResponse Source #
Parse a HttpResponse from ByteString
type ValidationResult = Either String () Source #
validateResponseBytes :: ByteString -> NormalizedSwagger -> OperationId -> ValidationResult Source #
Validate a response, from a particular operation id, (encoded in a byte-string) against a Swagger schema
validateResponseWithOperation :: HttpResponse -> NormalizedSwagger -> Operation -> ValidationResult Source #
Validate a response, from a particular operation against a Swagger schema
validateResponse :: HttpResponse -> NormalizedSwagger -> OperationId -> ValidationResult Source #
Validate a response, from a particular operation id against a Swagger schema