From 52ffe5d9f8e638eff0f9abd16e0f1fb99aaeb70e Mon Sep 17 00:00:00 2001 From: Romain Leroux Date: Wed, 10 Jan 2024 15:43:37 +0100 Subject: [PATCH] Adapt code to apache-avro 0.16.0 --- Cargo.lock | 429 ++++++++++++----------- Cargo.toml | 2 +- src/templates.rs | 46 ++- tests/schemas/complex.avsc | 2 +- tests/schemas/complex.rs | 1 - tests/schemas/map_default.avsc | 2 +- tests/schemas/map_default.rs | 1 - tests/schemas/nested_record_default.avsc | 2 +- tests/schemas/nested_record_default.rs | 1 - tests/schemas/nullable.avsc | 2 +- tests/schemas/nullable.rs | 1 - tests/schemas/record.avsc | 6 +- tests/schemas/record.rs | 13 +- 13 files changed, 279 insertions(+), 229 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 074aa81..7aa4a47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,25 +9,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] -name = "aho-corasick" -version = "1.0.4" +name = "ahash" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ - "memchr", + "cfg-if", + "once_cell", + "version_check", + "zerocopy", ] [[package]] -name = "android-tzdata" -version = "0.1.1" +name = "aho-corasick" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -39,33 +45,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", "windows-sys", @@ -73,12 +79,11 @@ dependencies = [ [[package]] name = "apache-avro" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0fdddc3fdac97394ffcc5c89c634faa9c1c166ced54189af34e407c97b6ee7" +checksum = "ceb7c683b2f8f40970b70e39ff8be514c95b96fcb9c4af87e1ed2cb2e10801a0" dependencies = [ "apache-avro-derive", - "byteorder", "digest", "lazy_static", "libflate", @@ -86,7 +91,7 @@ dependencies = [ "num-bigint", "quad-rand", "rand", - "regex", + "regex-lite", "serde", "serde_json", "strum", @@ -94,20 +99,19 @@ dependencies = [ "thiserror", "typed-builder", "uuid", - "zerocopy", ] [[package]] name = "apache-avro-derive" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6686cd705badba064ec2322b9c3d72f5c70db8394e486bbb56e84fbdb3fa158c" +checksum = "e317e411016923787d14f6deb741c1a1d036e64c2785b079747c852f7fae5ca4" dependencies = [ "darling 0.20.3", "proc-macro2", "quote", "serde_json", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -124,9 +128,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -139,29 +143,14 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", "serde", ] -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -170,31 +159,29 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ - "android-tzdata", "num-traits", "serde", ] [[package]] name = "clap" -version = "4.4.0" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" dependencies = [ "anstream", "anstyle", @@ -204,21 +191,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -226,11 +213,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -244,6 +240,31 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + [[package]] name = "crypto-common" version = "0.1.6" @@ -298,7 +319,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -320,9 +341,15 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.29", + "syn 2.0.48", ] +[[package]] +name = "dary_heap" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7762d17f1241643615821a8455a0b2c3e803784b058693d990b11f2dce25a0ca" + [[package]] name = "derive_builder" version = "0.12.0" @@ -372,30 +399,19 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fnv" @@ -415,9 +431,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -432,15 +448,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" dependencies = [ "aho-corasick", "bstr", - "fnv", "log", - "regex", + "regex-automata", + "regex-syntax", ] [[package]] @@ -454,6 +470,15 @@ dependencies = [ "walkdir", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "heck" version = "0.4.1" @@ -468,26 +493,25 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "ignore" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" dependencies = [ + "crossbeam-deque", "globset", - "lazy_static", "log", "memchr", - "regex", + "regex-automata", "same-file", - "thread_local", "walkdir", "winapi-util", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "lazy_static" @@ -497,35 +521,39 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libflate" -version = "1.4.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ff4ae71b685bbad2f2f391fe74f6b7659a34871c08b210fdc039e43bee07d18" +checksum = "9f7d5654ae1795afc7ff76f4365c2c8791b0feb18e8996a96adad8ffd7c3b2bf" dependencies = [ "adler32", + "core2", "crc32fast", + "dary_heap", "libflate_lz77", ] [[package]] name = "libflate_lz77" -version = "1.2.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52d3a8bfc85f250440e4424db7d857e241a3aebbbe301f3eb606ab15c39acbf" +checksum = "be5f52fb8c451576ec6b79d3f4deb327398bc05bbdbd99021a6e77a4c855d524" dependencies = [ + "core2", + "hashbrown", "rle-decode-fast", ] [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "log" @@ -535,9 +563,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "num-bigint" @@ -562,34 +590,35 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pest" -version = "2.7.2" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" dependencies = [ "pest", "pest_generator", @@ -597,22 +626,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" dependencies = [ "once_cell", "pest", @@ -637,9 +666,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -652,9 +681,9 @@ checksum = "658fa1faf7a4cc5f057c9ee5ef560f717ad9d8dc66d975267f709624d6e1ab88" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -691,18 +720,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.9.4" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -712,20 +741,26 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" + [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rle-decode-fast" @@ -735,7 +770,7 @@ checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" [[package]] name = "rsgen-avro" -version = "0.13.0" +version = "0.14.0" dependencies = [ "apache-avro", "chrono", @@ -756,11 +791,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.9" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -775,9 +810,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "same-file" @@ -790,38 +825,38 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.12" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -830,9 +865,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -853,15 +888,15 @@ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -877,9 +912,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -888,9 +923,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", @@ -901,9 +936,9 @@ dependencies = [ [[package]] name = "tera" -version = "1.19.0" +version = "1.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab29bb4f3e256ae6ad5c3e2775aa1f8829f2c0c101fc407bfd3a6df15c60c5" +checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8" dependencies = [ "globwalk", "lazy_static", @@ -912,55 +947,54 @@ dependencies = [ "regex", "serde", "serde_json", - "thread_local", "unic-segment", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] -name = "thread_local" -version = "1.1.4" +name = "typed-builder" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "34085c17941e36627a879208083e25d357243812c30e7d7387c3b954f30ade16" dependencies = [ - "once_cell", + "typed-builder-macro", ] [[package]] -name = "typed-builder" -version = "0.14.0" +name = "typed-builder-macro" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cba322cb9b7bc6ca048de49e83918223f35e7a86311267013afff257004870" +checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" @@ -1020,9 +1054,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "utf8parse" @@ -1032,9 +1066,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ "getrandom", "serde", @@ -1048,9 +1082,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -1080,9 +1114,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1095,18 +1129,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1119,45 +1153,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "yansi" @@ -1167,21 +1201,20 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.6.3" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3b9c234616391070b0b173963ebc65a9195068e7ed3731c6edac2ec45ebe106" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.6.3" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f7f3a471f98d0a61c34322fbbfd10c384b07687f680d4119813713f72308d91" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] diff --git a/Cargo.toml b/Cargo.toml index 760b75c..89b86a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsgen-avro" -version = "0.13.0" +version = "0.14.0" authors = ["Romain Leroux "] edition = "2021" description = "Command line and library for generating Rust types from Avro schemas" diff --git a/src/templates.rs b/src/templates.rs index 0caacd2..752fba1 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -501,7 +501,9 @@ impl Templater { } } - Schema::TimeMillis | Schema::TimestampMillis if self.use_chrono_dates => { + Schema::TimeMillis | Schema::TimestampMillis | Schema::LocalTimestampMillis + if self.use_chrono_dates => + { f.push(name_std.clone()); t.insert(name_std.clone(), "chrono::NaiveDateTime".to_string()); w.insert(name_std.clone(), "chrono::naive::serde::ts_milliseconds"); @@ -511,7 +513,9 @@ impl Templater { } } - Schema::TimeMicros | Schema::TimestampMicros if self.use_chrono_dates => { + Schema::TimeMicros | Schema::TimestampMicros | Schema::LocalTimestampMicros + if self.use_chrono_dates => + { f.push(name_std.clone()); t.insert(name_std.clone(), "chrono::NaiveDateTime".to_string()); w.insert(name_std.clone(), "chrono::naive::serde::ts_microseconds"); @@ -533,7 +537,9 @@ impl Templater { Schema::Long | Schema::TimeMicros | Schema::TimestampMillis - | Schema::TimestampMicros => { + | Schema::LocalTimestampMillis + | Schema::TimestampMicros + | Schema::LocalTimestampMicros => { f.push(name_std.clone()); t.insert(name_std.clone(), "i64".to_string()); if let Some(default) = default { @@ -786,6 +792,8 @@ impl Templater { | Schema::TimeMicros | Schema::TimestampMillis | Schema::TimestampMicros + | Schema::LocalTimestampMillis + | Schema::LocalTimestampMicros if self.use_chrono_dates => { "NaiveDateTime(chrono::NaiveDateTime)".into() @@ -795,6 +803,8 @@ impl Templater { Schema::TimeMicros => "TimeMicros(i64)".into(), Schema::TimestampMillis => "TimestampMillis(i64)".into(), Schema::TimestampMicros => "TimestampMicros(i64)".into(), + Schema::LocalTimestampMillis => "LocalTimestampMillis(i64)".into(), + Schema::LocalTimestampMicros => "LocalTimestampMicros(i64)".into(), Schema::Duration => "Duration(apache_avro::Duration)".into(), Schema::Null => err!( "Invalid Schema::Null not in first position on an UnionSchema variants" @@ -883,7 +893,9 @@ impl Templater { _ => err!("Invalid default: {:?}", default)?, }, - Schema::TimeMillis | Schema::TimestampMillis if self.use_chrono_dates => { + Schema::TimeMillis | Schema::TimestampMillis | Schema::LocalTimestampMillis + if self.use_chrono_dates => + { match default { Value::Number(n) if n.is_i64() => format!( "chrono::NaiveDateTime::from_timestamp_millis({}).unwrap()", @@ -893,7 +905,9 @@ impl Templater { } } - Schema::TimeMicros | Schema::TimestampMicros if self.use_chrono_dates => { + Schema::TimeMicros | Schema::TimestampMicros | Schema::LocalTimestampMicros + if self.use_chrono_dates => + { match default { Value::Number(n) if n.is_i64() => format!( "chrono::NaiveDateTime::from_timestamp_micros({}).unwrap()", @@ -911,7 +925,9 @@ impl Templater { Schema::Long | Schema::TimeMicros | Schema::TimestampMillis - | Schema::TimestampMicros => match default { + | Schema::TimestampMicros + | Schema::LocalTimestampMillis + | Schema::LocalTimestampMicros => match default { Value::Number(n) if n.is_i64() => n.to_string(), _ => err!("Invalid default: {:?}", default)?, }, @@ -1189,8 +1205,8 @@ pub(crate) fn array_type(inner: &Schema, gen_state: &GenState) -> Result Schema::Date => "Vec".into(), Schema::TimeMillis => "Vec".into(), Schema::TimeMicros => "Vec".into(), - Schema::TimestampMillis => "Vec".into(), - Schema::TimestampMicros => "Vec".into(), + Schema::TimestampMillis | Schema::LocalTimestampMillis => "Vec".into(), + Schema::TimestampMicros | Schema::LocalTimestampMicros => "Vec".into(), Schema::Uuid => "Vec".into(), Schema::Decimal { .. } => "Vec".into(), @@ -1252,6 +1268,8 @@ pub(crate) fn map_type(inner: &Schema, gen_state: &GenState) -> Result { | Schema::TimeMicros | Schema::TimestampMillis | Schema::TimestampMicros + | Schema::LocalTimestampMillis + | Schema::LocalTimestampMicros if gen_state.use_chrono_dates => { map_of("chrono::NaiveDateTime") @@ -1260,8 +1278,8 @@ pub(crate) fn map_type(inner: &Schema, gen_state: &GenState) -> Result { Schema::Date => map_of("i32"), Schema::TimeMillis => map_of("i32"), Schema::TimeMicros => map_of("i64"), - Schema::TimestampMillis => map_of("i64"), - Schema::TimestampMicros => map_of("i64"), + Schema::TimestampMillis | Schema::LocalTimestampMillis => map_of("i64"), + Schema::TimestampMicros | Schema::LocalTimestampMicros => map_of("i64"), Schema::Uuid => map_of("uuid::Uuid"), Schema::Decimal { .. } => map_of("apache_avro::Decimal"), @@ -1337,6 +1355,8 @@ fn union_enum_variant(schema: &Schema, gen_state: &GenState) -> Result { Schema::TimeMicros => "TimeMicros".into(), Schema::TimestampMillis => "TimestampMillis".into(), Schema::TimestampMicros => "TimestampMicros".into(), + Schema::LocalTimestampMillis => "LocalTimestampMillis".into(), + Schema::LocalTimestampMicros => "LocalTimestampMicros".into(), Schema::Duration => "Duration".into(), Schema::Null => { err!("Invalid Schema::Null not in first position on an UnionSchema variants")? @@ -1401,6 +1421,8 @@ pub(crate) fn option_type(inner: &Schema, gen_state: &GenState) -> Result { "Option".into() @@ -1408,8 +1430,8 @@ pub(crate) fn option_type(inner: &Schema, gen_state: &GenState) -> Result "Option".into(), Schema::TimeMillis => "Option".into(), Schema::TimeMicros => "Option".into(), - Schema::TimestampMillis => "Option".into(), - Schema::TimestampMicros => "Option".into(), + Schema::TimestampMillis | Schema::LocalTimestampMillis => "Option".into(), + Schema::TimestampMicros | Schema::LocalTimestampMicros => "Option".into(), Schema::Uuid => "Option".into(), Schema::Decimal { .. } => "Option".into(), diff --git a/tests/schemas/complex.avsc b/tests/schemas/complex.avsc index acb10f5..1634819 100644 --- a/tests/schemas/complex.avsc +++ b/tests/schemas/complex.avsc @@ -7,7 +7,7 @@ {"name": "favorite_number", "type": "int", "default": 7}, {"name": "likes_pizza", "type": "boolean", "default": false}, {"name": "oye", "type": "float", "default": 1.1}, - {"name": "aa-i32", + {"name": "aa_i32", "type": {"type": "array", "items": {"type": "array", "items": "int"}}, "default": [[0], [12, -1]]} ] diff --git a/tests/schemas/complex.rs b/tests/schemas/complex.rs index 770cd95..03f0744 100644 --- a/tests/schemas/complex.rs +++ b/tests/schemas/complex.rs @@ -7,7 +7,6 @@ pub struct User { pub favorite_number: i32, pub likes_pizza: bool, pub oye: f32, - #[serde(rename = "aa-i32")] pub aa_i32: Vec>, } diff --git a/tests/schemas/map_default.avsc b/tests/schemas/map_default.avsc index 21bffd3..b81e83b 100644 --- a/tests/schemas/map_default.avsc +++ b/tests/schemas/map_default.avsc @@ -2,7 +2,7 @@ "type": "record", "name": "User", "fields": [ - {"name": "m-f64", + {"name": "m_f64", "type": {"type": "map", "values": "double"}, "default": {"a": 12.0, "b": 42.1}} ] diff --git a/tests/schemas/map_default.rs b/tests/schemas/map_default.rs index 60b7011..df2e913 100644 --- a/tests/schemas/map_default.rs +++ b/tests/schemas/map_default.rs @@ -2,7 +2,6 @@ #[derive(Debug, PartialEq, Clone, serde::Deserialize, serde::Serialize)] #[serde(default)] pub struct User { - #[serde(rename = "m-f64")] pub m_f64: ::std::collections::HashMap, } diff --git a/tests/schemas/nested_record_default.avsc b/tests/schemas/nested_record_default.avsc index 254df7d..af8ddaf 100644 --- a/tests/schemas/nested_record_default.avsc +++ b/tests/schemas/nested_record_default.avsc @@ -2,7 +2,7 @@ "type": "record", "name": "User", "fields": [ { - "name": "m-f64", + "name": "m_f64", "type": { "type": "record", "name": "Inner", diff --git a/tests/schemas/nested_record_default.rs b/tests/schemas/nested_record_default.rs index 69a551a..9928c7a 100644 --- a/tests/schemas/nested_record_default.rs +++ b/tests/schemas/nested_record_default.rs @@ -7,7 +7,6 @@ pub struct Inner { #[derive(Debug, PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)] #[serde(default)] pub struct User { - #[serde(rename = "m-f64")] pub m_f64: Inner, } diff --git a/tests/schemas/nullable.avsc b/tests/schemas/nullable.avsc index 94bbc1f..637cdc6 100644 --- a/tests/schemas/nullable.avsc +++ b/tests/schemas/nullable.avsc @@ -3,7 +3,7 @@ "name": "test", "fields": [ {"name": "a", "type": "long", "default": 42}, - {"name": "b-b", "type": "string", "default": "na"}, + {"name": "b_b", "type": "string", "default": "na"}, {"name": "c", "type": ["null", "int"], "default": null} ] } diff --git a/tests/schemas/nullable.rs b/tests/schemas/nullable.rs index 4595c60..db824cc 100644 --- a/tests/schemas/nullable.rs +++ b/tests/schemas/nullable.rs @@ -4,7 +4,6 @@ pub struct Test { #[serde(deserialize_with = "nullable_test_a")] pub a: i64, - #[serde(rename = "b-b")] #[serde(deserialize_with = "nullable_test_b_b")] pub b_b: String, pub c: Option, diff --git a/tests/schemas/record.avsc b/tests/schemas/record.avsc index 42a9588..7995934 100644 --- a/tests/schemas/record.avsc +++ b/tests/schemas/record.avsc @@ -7,8 +7,8 @@ {"name": "likes_pizza", "type": "boolean", "default": false}, {"name": "b", "type": "bytes", "default": "\u00FF"}, {"name": "union_b", "type": ["null", "bytes"], "default": null}, - {"name": "a-bool", "type": {"type": "array", "items": "boolean"}, "default": [true, false]}, - {"name": "a-i32", "type": {"type": "array", "items": "int"}, "default": [12, -1]}, - {"name": "m-f64", "type": {"type": "map", "values": "double"}} + {"name": "A_Bool", "type": {"type": "array", "items": "boolean"}, "default": [true, false]}, + {"name": "SomeInteger", "type": {"type": "array", "items": "int"}, "default": [12, -1]}, + {"name": "map_of_f64", "type": {"type": "map", "values": "double"}} ] } diff --git a/tests/schemas/record.rs b/tests/schemas/record.rs index be9991c..7c98f58 100644 --- a/tests/schemas/record.rs +++ b/tests/schemas/record.rs @@ -13,14 +13,13 @@ pub struct User { #[serde(with = "serde_bytes")] #[serde(default = "default_user_union_b")] pub union_b: Option>, - #[serde(rename = "a-bool")] + #[serde(rename = "A_Bool")] #[serde(default = "default_user_a_bool")] pub a_bool: Vec, - #[serde(rename = "a-i32")] - #[serde(default = "default_user_a_i32")] - pub a_i32: Vec, - #[serde(rename = "m-f64")] - pub m_f64: ::std::collections::HashMap, + #[serde(rename = "SomeInteger")] + #[serde(default = "default_user_some_integer")] + pub some_integer: Vec, + pub map_of_f64: ::std::collections::HashMap, } #[inline(always)] @@ -39,4 +38,4 @@ fn default_user_union_b() -> Option> { None } fn default_user_a_bool() -> Vec { vec![true, false] } #[inline(always)] -fn default_user_a_i32() -> Vec { vec![12, -1] } +fn default_user_some_integer() -> Vec { vec![12, -1] }