swagger-test 0.2.3 → 0.2.4
raw patch · 5 files changed
+19/−11 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +2/−1
- app/Main.hs +4/−2
- src/Test/Swagger/Gen.hs +4/−1
- src/Test/Swagger/Request.hs +6/−6
- swagger-test.cabal +3/−1
README.md view
@@ -7,7 +7,8 @@ It basically allow you to approximate the computation of the following proposition: -> valid(response, schema), response = execute(request), ∀ request ∈ schema+&space;\Rightarrow&space;\underset{API}{valid}(output)&space;\\&space;\text{where}&space;\\&space;output&space;=&space;\underset{API}{request}(input))+ Which translates to:
app/Main.hs view
@@ -17,12 +17,14 @@ import qualified Data.ByteString.Lazy as LBS import Data.List import Data.Semigroup ((<>))-import Data.Swagger hiding (Format, info)+import Data.Swagger hiding (Format, info, version) import qualified Data.Text as T import qualified Data.Text.IO as TIO import Data.Text.Lazy.Builder import qualified Data.Text.Lazy.IO as LTIO+import Data.Version (showVersion) import Options.Applicative+import Paths_swagger_test (version) import System.Directory import System.Exit (die) import System.FilePath.Posix@@ -195,7 +197,7 @@ optsInfo = info (opts <**> helper) ( fullDesc <> progDesc "Execute one of the commands available depending on your needs"- <> header "Property-based testing tool for Swagger APIs"+ <> header ("Property-based testing tool for Swagger APIs - v. " <> showVersion version) <> footer "Run `COMMAND --help` to get command specific options help") doGenerate :: NormalizedSwagger
src/Test/Swagger/Gen.hs view
@@ -29,7 +29,7 @@ import Data.Maybe import Data.Monoid ((<>)) import Data.Scientific-import Data.Swagger+import Data.Swagger hiding (version) import Data.Swagger.Internal (SwaggerKind (..)) import qualified Data.Text as T import Data.Text.Encoding@@ -40,6 +40,8 @@ import Test.QuickCheck.Gen (unGen) import Test.QuickCheck.Random import Test.Swagger.Types+import Paths_swagger_test (version)+import Data.Version (showVersion) -- |Given a swagger.json schema, produce a Request that complies with the schema.@@ -129,6 +131,7 @@ <$> ((mk . fst &&& snd) <$> randomHeaders) <> [("Host", (T.pack . (^. name)) <$> mHost)] <> [("Content-Type", fst <$> maybeMimeAndBody)]+ <> [("User-Agent", Just $ "swagger-test/" <> T.pack (showVersion version))] -- use scheme from operation, if defined, or from global scheme <- elements $ fromMaybe [schemeForPort $ view port =<< mHost] (operation ^. schemes <|> s ^. schemes)
src/Test/Swagger/Request.hs view
@@ -13,18 +13,18 @@ module Test.Swagger.Request (doHttpRequest) where import Control.Arrow-import qualified Data.ByteString.Lazy as LBS+import qualified Data.ByteString.Lazy as LBS import Data.CaseInsensitive import Data.Maybe import Data.Monoid-import qualified Data.Text as T+import qualified Data.Text as T import Data.Text.Encoding import Network.HTTP.Client+import Network.HTTP.Client.TLS import Network.HTTP.Types-import Network.HTTP.Client.TLS-import Test.Swagger.Types hiding (requestBody, requestHeaders,- responseBody, responseHeaders,- responseStatus)+import Test.Swagger.Types hiding (requestBody, requestHeaders,+ responseBody, responseHeaders,+ responseStatus) -- |Executes the HTTP request and returns the HTTP response doHttpRequest :: HttpRequest -> IO HttpResponse
swagger-test.cabal view
@@ -1,5 +1,5 @@ name: swagger-test-version: 0.2.3+version: 0.2.4 synopsis: Testing of Swagger APIs description: This package provides a library and executable tool that supports testing APIs specified with Swagger. It@@ -29,6 +29,7 @@ , Test.Swagger.Request , Test.Swagger.Types , Test.Swagger.Validate+ other-modules: Paths_swagger_test build-depends: base >= 4.7 && < 5 , QuickCheck == 2.10.* , aeson@@ -57,6 +58,7 @@ executable swagger-test hs-source-dirs: app main-is: Main.hs+ other-modules: Paths_swagger_test ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N build-depends: base , aeson