packages feed

hjsonschema 1.6.3 → 1.7.0

raw patch · 7 files changed

+19/−27 lines, 7 filesdep ~basedep ~hjsonpointerPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, hjsonpointer

API changes (from Hackage documentation)

- JSONSchema.Validator.Utils: allUniqueValues' :: NonEmpty Value -> Bool
- JSONSchema.Validator.Utils: allUnique :: (Ord a) => [a] -> Bool
+ JSONSchema.Validator.Utils: allUnique :: (Foldable f, Ord a) => f a -> Bool
- JSONSchema.Validator.Utils: allUniqueValues :: Vector Value -> Bool
+ JSONSchema.Validator.Utils: allUniqueValues :: (Foldable f, Functor f) => f Value -> Bool

Files

changelog.md view
@@ -1,3 +1,8 @@+# 1.7.0+++ Test with GHC 8.2. Drop GHC 7.8.++ Rework `allUniqueValues` related utility functions.+ # 1.6.3  + Bump hjsonpointer and QuickCheck.
hjsonschema.cabal view
@@ -1,5 +1,5 @@ name:               hjsonschema-version:            1.6.3+version:            1.7.0 synopsis:           JSON Schema library homepage:           https://github.com/seagreen/hjsonschema license:            MIT@@ -9,7 +9,8 @@ category:           Data build-type:         Simple cabal-version:      >=1.10-tested-with:        GHC == 7.8.4, GHC == 7.10.2, GHC == 8.0.1+-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing:+Tested-With:        GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1 extra-source-files:   changelog.md   JSON-Schema-Test-Suite/remotes/*.json@@ -58,7 +59,7 @@       JSONSchema.Validator.Draft4.Object.Properties     , Import   build-depends:-      base                 >= 4.7    && < 4.10+      base                 >= 4.7    && < 4.11     -- 0.11 is for `.:!`:     , aeson                >= 0.11   && < 1.3     , bytestring           >= 0.10   && < 0.11@@ -66,7 +67,7 @@     , file-embed           >= 0.0.8  && < 0.1     , filepath             >= 1.3    && < 1.5     , hashable             >= 1.2    && < 1.3-    , hjsonpointer         >= 1.1    && < 1.3+    , hjsonpointer         >= 1.1    && < 1.4     -- 0.4.30 is for parseUrlThrow:     , http-client          >= 0.4.30 && < 0.6     , http-types           >= 0.8    && < 0.10@@ -161,7 +162,3 @@     , hspec     , wai-app-static     , warp--source-repository head-  type: git-  location: git://github.com/seagreen/hjsonschema.git
src/Import.hs view
@@ -5,7 +5,6 @@  import           Data.Aeson          as Export import           Data.HashMap.Strict as Export (HashMap)-import           Data.List           as Export (length, null) -- for older GHCs import           Data.List.NonEmpty  as Export (NonEmpty) import           Data.Vector         as Export (Vector) import           Test.QuickCheck     as Export hiding ((.&.), Failure,
src/JSONSchema/Validator/Draft4/Any.hs view
@@ -216,9 +216,9 @@  enumVal :: EnumValidator -> Value -> Maybe EnumInvalid enumVal a@(EnumValidator vs) x-    | not (UT.allUniqueValues' vs) = Nothing-    | x `elem` vs                  = Nothing-    | otherwise                    = Just $ EnumInvalid a x+    | not (UT.allUniqueValues vs) = Nothing+    | x `elem` vs                 = Nothing+    | otherwise                   = Just $ EnumInvalid a x  -------------------------------------------------- -- * type@@ -377,8 +377,7 @@     -> Value     -> Maybe (AnyOfInvalid err) anyOfVal f (AnyOf subSchemas) x-    -- Replace with @null@ once we drop GHC 7.8:-    | any (((==) 0 . length) . snd) perhapsFailures = Nothing+    | any (null . snd) perhapsFailures = Nothing     | otherwise = AnyOfInvalid <$> NE.nonEmpty failures   where     perhapsFailures :: [(JP.Index, [err])]
src/JSONSchema/Validator/Draft4/Object.hs view
@@ -96,9 +96,6 @@  requiredVal :: Required -> HashMap Text Value -> Maybe RequiredInvalid requiredVal r@(Required ts) x-    -- NOTE: When we no longer need to support GHCs before 7.10-    -- we can use null from Prelude throughout the library-    -- instead of specialized versions.     | Set.null ts        = Nothing     | Set.null leftovers = Nothing     | otherwise          = Just (RequiredInvalid r leftovers x)
src/JSONSchema/Validator/Utils.hs view
@@ -83,16 +83,11 @@ -- * allUniqueValues -------------------------------------------------- -allUniqueValues :: Vector Value -> Bool-allUniqueValues = allUnique . fmap OrdValue . V.toList---- NOTE: When we no longer support GHC 7.8 we can generalize--- allUnique to work on any Foldable and remove this function.-allUniqueValues' :: NonEmpty Value -> Bool-allUniqueValues' = allUnique . fmap OrdValue . NE.toList+allUniqueValues :: (Foldable f, Functor f) => f Value -> Bool+allUniqueValues = allUnique . fmap OrdValue -allUnique :: (Ord a) => [a] -> Bool-allUnique xs = S.size (S.fromList xs) == length xs+allUnique :: (Foldable f, Ord a) => f a -> Bool+allUnique xs = S.size (S.fromList (toList xs)) == length xs  -- | OrdValue's Ord instance needs benchmarking, but it allows us to -- use our 'allUnique' function instead of O(n^2) nub, so it's probably
test/Local/Validation.hs view
@@ -1,7 +1,7 @@  module Local.Validation where -import           Protolude           hiding (msg)+import           Protolude  import           Data.Aeson import qualified Data.Aeson          as AE