mu-avro 0.4.0.2 → 0.4.0.3
raw patch · 5 files changed
+35/−25 lines, 5 filesdep ~mu-rpcPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: mu-rpc
API changes (from Hackage documentation)
- Mu.Quasi.Avro.Example: type ExampleFromFile = ('[ 'DRecord "person" '[ 'FieldDef "firstName" ('TPrimitive Text), 'FieldDef "lastName" ('TPrimitive Text), 'FieldDef "age" ('TOption ('TPrimitive Int64)), 'FieldDef "gender" ('TOption ('TSchematic "gender")), 'FieldDef "address" ('TSchematic "address"), 'FieldDef "lucky_numbers" ('TList ('TPrimitive Int64))], 'DEnum "gender" '[ 'ChoiceDef "male", 'ChoiceDef "female", 'ChoiceDef "nb"], 'DRecord "address" '[ 'FieldDef "postcode" ('TPrimitive Text), 'FieldDef "country" ('TPrimitive Text)]])
+ Mu.Quasi.Avro.Example: type ExampleFromFile = ('[ 'DRecord "person" '[ 'FieldDef "firstName" ('TPrimitive Text), 'FieldDef "lastName" ('TPrimitive Text), 'FieldDef "age" ('TOption ('TPrimitive Int64)), 'FieldDef "gender" ('TOption ('TSchematic "gender")), 'FieldDef "address" ('TSchematic "address"), 'FieldDef "lucky_numbers" ('TList ('TPrimitive Int64)), 'FieldDef "things" ('TSchematic "map")], 'DEnum "gender" '[ 'ChoiceDef "male", 'ChoiceDef "female", 'ChoiceDef "nb"], 'DRecord "address" '[ 'FieldDef "postcode" ('TPrimitive Text), 'FieldDef "country" ('TPrimitive Text)]])
- Mu.Quasi.Avro.Example: type ExampleProtocol = '[ 'DRecord "DuplicatedPersonError" '[ 'FieldDef "message" ('TPrimitive Text)], 'DRecord "NotFoundError" '[ 'FieldDef "message" ('TPrimitive Text)], 'DRecord "PeopleRequest" '[ 'FieldDef "name" ('TPrimitive Text)], 'DRecord "PeopleResponse" '[ 'FieldDef "result" ('TUnion '[ 'TSchematic "Person", 'TSchematic "NotFoundError", 'TSchematic "DuplicatedPersonError"])], 'DRecord "Person" '[ 'FieldDef "name" ('TPrimitive Text), 'FieldDef "age" ('TPrimitive Int32)]]
+ Mu.Quasi.Avro.Example: type ExampleProtocol = '[ 'DRecord "DuplicatedPersonError" '[ 'FieldDef "message" ('TPrimitive Text)], 'DRecord "NotFoundError" '[ 'FieldDef "message" ('TPrimitive Text)], 'DRecord "PeopleRequest" '[ 'FieldDef "name" ('TPrimitive Text)], 'DRecord "PeopleResponse" '[ 'FieldDef "result" ('TUnion '[ 'TSchematic "Person", 'TSchematic "NotFoundError", 'TSchematic "DuplicatedPersonError"])], 'DRecord "Person" '[ 'FieldDef "name" ('TPrimitive Text), 'FieldDef "age" ('TPrimitive Int32), 'FieldDef "things" ('TMap ('TPrimitive Text) ('TPrimitive Int32))]]
Files
- mu-avro.cabal +25/−21
- src/Mu/Quasi/Avro.hs +1/−1
- test/Avro.hs +6/−2
- test/avro/example.avdl +1/−0
- test/avro/example.avsc +2/−1
mu-avro.cabal view
@@ -1,5 +1,5 @@ name: mu-avro-version: 0.4.0.2+version: 0.4.0.3 synopsis: Avro serialization support for Mu microservices description: You can use @mu-avro@ to read AVRO Schema Declarations for mu-haskell@@ -12,7 +12,10 @@ category: Network build-type: Simple cabal-version: >=1.10-data-files: test/avro/*.avsc, test/avro/*.avdl+data-files:+ test/avro/*.avsc+ test/avro/*.avdl+ homepage: https://higherkindness.io/mu-haskell/ bug-reports: https://github.com/higherkindness/mu-haskell/issues @@ -28,24 +31,24 @@ Mu.Quasi.Avro.Example build-depends:- aeson >=1.4 && <2- , avro >=0.5.1 && <0.6- , base >=4.12 && <5- , bytestring >=0.10 && <0.11- , containers >=0.6 && <0.7- , deepseq >=1.4 && <2- , language-avro >=0.1.3 && <0.2- , mu-rpc ==0.4.*- , mu-schema ==0.3.*- , sop-core >=0.5.0 && <0.6- , tagged >=0.8.6 && <0.9- , template-haskell >=2.14 && <2.17- , text >=1.2 && <2- , time >=1.9 && <2- , transformers >=0.5 && <0.6- , unordered-containers >=0.2 && <0.3- , uuid >=1.3 && <2- , vector >=0.12 && <0.13+ aeson >=1.4 && <2+ , avro >=0.5.1 && <0.6+ , base >=4.12 && <5+ , bytestring >=0.10 && <0.11+ , containers >=0.6 && <0.7+ , deepseq >=1.4 && <2+ , language-avro >=0.1.3 && <0.2+ , mu-rpc >=0.4 && <0.6+ , mu-schema >=0.3 && <0.4+ , sop-core >=0.5.0 && <0.6+ , tagged >=0.8.6 && <0.9+ , template-haskell >=2.14 && <2.17+ , text >=1.2 && <2+ , time >=1.9 && <2+ , transformers >=0.5 && <0.6+ , unordered-containers >=0.2 && <0.3+ , uuid >=1.3 && <2+ , vector >=0.12 && <0.13 hs-source-dirs: src default-language: Haskell2010@@ -57,8 +60,9 @@ avro >=0.5.1 && <0.6 , base >=4.12 && <5 , bytestring >=0.10 && <0.11+ , containers >=0.6 && <0.7 , mu-avro- , mu-schema ==0.3.*+ , mu-schema >=0.3 && <0.4 hs-source-dirs: test default-language: Haskell2010
src/Mu/Quasi/Avro.hs view
@@ -139,7 +139,7 @@ A.String (Just A.UUID) -> [t|'TPrimitive UUID|] A.String _ -> [t|'TPrimitive T.Text|] A.Array item -> [t|'TList $(schemaFromAvroType item)|]- A.Map values -> [t|'TMap T.Text $(schemaFromAvroType values)|]+ A.Map values -> [t|'TMap ('TPrimitive T.Text) $(schemaFromAvroType values)|] A.NamedType typeName -> [t|'TSchematic $(textToStrLit (A.baseName typeName))|] A.Enum {} -> fail "should never happen, please, file an issue"
test/Avro.hs view
@@ -8,6 +8,7 @@ import Data.Avro import qualified Data.ByteString.Lazy as BS+import qualified Data.Map as M import System.Environment import Mu.Adapter.Avro ()@@ -18,8 +19,11 @@ exampleAddress = Address "1111BB" "Spain" examplePerson1, examplePerson2 :: Person-examplePerson1 = Person "Haskellio" "Gomez" (Just 30) (Just Male) exampleAddress [1,2,3]-examplePerson2 = Person "Cuarenta" "Siete" Nothing Nothing exampleAddress []+examplePerson1+ = Person "Haskellio" "Gomez" (Just 30) (Just Male) exampleAddress [1,2,3] M.empty+examplePerson2+ = Person "Cuarenta" "Siete" Nothing Nothing exampleAddress []+ (M.fromList [("hola", 1), ("hello", 2)]) deriving via (WithSchema ExampleSchema "person" Person) instance HasAvroSchema Person deriving via (WithSchema ExampleSchema "person" Person) instance FromAvro Person
test/avro/example.avdl view
@@ -3,6 +3,7 @@ record Person { string name; int age;+ map<int> things; } error NotFoundError {
test/avro/example.avsc view
@@ -18,6 +18,7 @@ ] } },- {"name": "lucky_numbers", "type": { "type": "array", "items": "long" } }+ {"name": "lucky_numbers", "type": { "type": "array", "items": "long" } },+ {"name": "things", "type": "map", "values": "int"} ] }