avro 0.4.5.2 → 0.4.5.3
raw patch · 4 files changed
+19/−8 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- avro.cabal +1/−1
- src/Data/Avro/Decode/Get.hs +5/−5
- src/Data/Avro/Schema.hs +12/−1
- test/data/small.avsc +1/−1
avro.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: avro-version: 0.4.5.2+version: 0.4.5.3 synopsis: Avro serialization support for Haskell description: Avro serialization and deserialization support for Haskell category: Data
src/Data/Avro/Decode/Get.hs view
@@ -33,9 +33,9 @@ import qualified Data.Vector as V import Prelude as P -import Data.Avro.Codec-import Data.Avro.DecodeRaw-import Data.Avro.Schema as S+import Data.Avro.Codec+import Data.Avro.DecodeRaw+import Data.Avro.Schema as S class GetAvro a where getAvro :: Get a@@ -119,7 +119,7 @@ getCodec :: Monad m => Maybe BL.ByteString -> m Codec getCodec (Just "null") = pure nullCodec getCodec (Just "deflate") = pure deflateCodec-getCodec (Just x) = fail $ "Unrecognized codec: " <> BC.unpack x+getCodec (Just x) = error $ "Unrecognized codec: " <> BC.unpack x getCodec Nothing = pure nullCodec @@ -230,6 +230,6 @@ sFromIntegral :: forall a b m. (Monad m, Bounded a, Bounded b, Integral a, Integral b) => a -> m b sFromIntegral a | aI > fromIntegral (maxBound :: b) ||- aI < fromIntegral (minBound :: b) = fail "Integral overflow."+ aI < fromIntegral (minBound :: b) = error "Integral overflow." | otherwise = return (fromIntegral a) where aI = fromIntegral a :: Integer
src/Data/Avro/Schema.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-}@@ -373,6 +374,14 @@ aliases <- mkAliases typeName <$> (o .:? "aliases" .!= []) size <- o .: "size" pure $ Fixed typeName aliases size+ "null" -> pure Null+ "boolean" -> pure Boolean+ "int" -> pure Int+ "long" -> pure Long+ "float" -> pure Float+ "double" -> pure Double+ "bytes" -> pure Bytes+ "string" -> pure String s -> fail $ "Unrecognized object type: " <> T.unpack s invalid -> typeMismatch "Invalid JSON for Avro Schema" invalid@@ -399,7 +408,7 @@ name <- o .: "name" doc <- o .:? "doc" ty <- parseSchemaJSON (Just record) =<< o .: "type"- let err = fail "Haskell Avro bindings does not support default for aliased or recursive types at this time."+ let err = error "Haskell Avro bindings does not support default for aliased or recursive types at this time." defM <- o .:! "default" def <- case parseFieldDefault err ty <$> defM of Just (Success x) -> return (Just x)@@ -520,7 +529,9 @@ return = pure Success a >>= k = k a Error e >>= _ = Error e+#if !MIN_VERSION_base(4,13,0) fail = MF.fail+#endif instance Functor Result where fmap f (Success x) = Success (f x) fmap _ (Error e) = Error e
test/data/small.avsc view
@@ -7,7 +7,7 @@ "type": { "name": "Opaque", "type": "fixed", "size": 16 } }, { "name": "correlation", "type": "Opaque" },- { "name": "tag", "type": ["int", "string"] },+ { "name": "tag", "type": ["int", {"type": "string"}] }, { "name": "ips", "type": { "type": "array", "items": "string" }