hjsonschema 0.5.2.2 → 0.5.3.0
raw patch · 4 files changed
+25/−17 lines, 4 filesdep +http-clientdep −http-conduitPVP ok
version bump matches the API change (PVP)
Dependencies added: http-client
Dependencies removed: http-conduit
API changes (from Hackage documentation)
Files
- README.md +9/−10
- changelog.txt +4/−0
- hjsonschema.cabal +2/−2
- src/Data/JsonSchema/Reference.hs +10/−5
README.md view
@@ -22,11 +22,11 @@ main = do eitherGraph <- JS.fetchRefs JS.draft4 rawSchema H.empty case eitherGraph of- Left e -> print e- Right g ->- case JS.compileDraft4 g rawSchema of- Left e2 -> print e2- Right a -> print $ JS.validate a invalidData+ Left e -> print e+ Right graph ->+ case JS.compileDraft4 graph rawSchema of+ Left e2 -> print e2+ Right schema -> print $ JS.validate schema invalidData rawSchema :: JS.RawSchema rawSchema = JS.RawSchema@@ -48,14 +48,13 @@ git submodule update --init -# Run Tests+# Prepare Tests - cd JSON-Schema-Test-Suite/remotes- python -m SimpleHTTPServer 1234++ `cd JSON-Schema-Test-Suite/remotes -Then run the normal `cabal test` from another terminal.++ `hserv --port=1234` / `python -m SimpleHTTPServer 1234` -Note that the tests require an internet connection.+Note that the `remote` test suite requires an internet connection. # Notes
changelog.txt view
@@ -1,3 +1,7 @@+# 0.5.3+++ Switch from http-conduit to http-client.+ # 0.5.2 + Add convenience function for validating and compiling draft 4 schemas
hjsonschema.cabal view
@@ -1,5 +1,5 @@ name: hjsonschema-version: 0.5.2.2+version: 0.5.3.0 synopsis: JSON Schema Draft 4 library homepage: https://github.com/seagreen/hjsonschema license: MIT@@ -32,7 +32,7 @@ , file-embed >= 0.0.8 && < 0.0.9 , hashable >= 1.2 && < 1.3 , hjsonpointer >= 0.2 && < 0.3- , http-conduit >= 2.1.5 && < 2.2+ , http-client >= 0.4.9 && < 0.5 , http-types >= 0.8 && < 0.9 , regexpr >= 0.5 && < 0.6 , scientific >= 0.3 && < 0.4
src/Data/JsonSchema/Reference.hs view
@@ -3,6 +3,7 @@ module Data.JsonSchema.Reference where +import Control.Applicative import Control.Arrow import Control.Exception import Control.Monad@@ -13,7 +14,7 @@ import Data.Monoid import Data.Text (Text) import qualified Data.Text as T-import Network.HTTP.Conduit+import Network.HTTP.Client import Prelude hiding (foldr) combineIdAndRef :: Text -> Text -> Text@@ -54,10 +55,14 @@ Right b -> return . left T.pack $ eitherDecode b safeGet :: Text -> IO (Either Text ByteString)-safeGet url =- catch- (return . Right =<< (simpleHttp . T.unpack) url)- handler+safeGet url = catch (Right <$> simpleHttp') handler where handler :: SomeException -> IO (Either Text ByteString) handler e = return . Left . T.pack . show $ e++ -- We don't want to depend on http-conduit, but Network.Http.Conduit.simpleHttp+ -- is the model for this function. simpleHttp also sets "Connection: close".+ simpleHttp' :: IO ByteString+ simpleHttp' = fmap responseBody $ withManager defaultManagerSettings $ \man -> do+ req <- parseUrl (T.unpack url)+ httpLbs req { requestHeaders = ("Connection", "close") : requestHeaders req } man