Repository navigation
Breaking changes:
- Requires .NET 10; for .NET Framework and .NET 6–9 use 3.4.x (
release/3.x, security and critical fixes) - New licence: PolyForm Noncommercial / PolyForm Small Business, commercial licence for larger organisations (https://soltechnology.dev/avroconvert)
- Collections written as one container entry per item, like other Avro tools (#118); 3.x files still read; old layout:
CollectionMode = SingleArray - Header-only file deserializes to an empty collection instead of
null - Missing non-nullable field throws instead of returning
default(#87); old behaviour:MissingFieldHandling = UseDefault nullwritten into a non-nullable field throws instead of writing an empty value (#87); old behaviour:NullValueHandling = WriteEmptynullin the data is read asnullalso for a field with[DefaultValue]; the default applies only to a missing field- Items and values annotated as nullable (
List<string?>,string?[],Dictionary<string, string?>) get the schema["null", T]; Schema Registry accepts it inBACKWARDmode, not inFORWARD/FULL [DefaultValue]of an enum member written as the symbol instead of the numberAvro2Json,Json2Avroand schema defaults ignoreJsonConvert.DefaultSettingsDeserializeHeadless<List<T>>andDeserializeHeadless(bytes, writer, reader, type)read all rows instead of the first one (#69)- Read objects created with the public parameterless constructor; a field missing in the data keeps its initialiser
DateTimeOffsetwritten as its UTC instant instead of the wall-clock time- Snappy blocks include the CRC-32 required by the specification
- Generated schemas differ, data stays compatible: names of generic records (#159),
time-micros, non-public[DataMember]members (#51),IDictionary<string, T>/IReadOnlyDictionary<string, T>as maps - Multidimensional arrays (
int[,]) throw; use jagged arrays (#26) SchemaConvertremoved; useAvroSchema(#73)- Numbers read into
dynamicfollow the reader schema type; unknownlogicalTyperead as its underlying type Deserialize(bytes, type)andDeserializeHeadless(bytes, …, type)throw the exception of the call instead ofTargetInvocationException- Reflection-based methods marked
[RequiresUnreferencedCode]/[RequiresDynamicCode] GenerateModeloutput:DateOnly/TimeOnly,usingdirectives,#nullable enable annotations, attributes that keep the schema ([DataContract],[AvroType],[AvroDecimal],[AvroFixed],[AvroUnion],[Description])- SolTechnology.Avro.Kafka rewritten on Confluent.SchemaRegistry 2.16 (wire format, schema evolution, references, subject name strategies); removed
KafkaConsumer,KafkaPropNames,ConfluentSchema - SolTechnology.Avro.Http follows System.Net.Http.Json (
GetFromAvroAsync,PostAsAvroAsync,ReadFromAvroAsync…), Minimal API results, streaming; old names[Obsolete] - Code compiled against a 4.0 preview must be rebuilt
Changes:
- Serialization and deserialization compiled per schema and type: several times faster, fewer allocations
- Added SolTechnology.Avro.Cli (
avroconvert):induce,compile,tojson,getschema,canonical,fingerprint,compat,registry - Added streaming:
Serialize<T>(IEnumerable<T> / IAsyncEnumerable<T>, Stream),Deserialize<T>(Stream)returningIAsyncEnumerable<T>, output toIBufferWriter<byte> - One way to pass a schema (
AvroSchema) and a codec (AvroConvertOptions); overloads taking schema text,CodecTypeor a file path hidden from IntelliSense, to be removed in the next major version - Added
AvroSchema(#73):Parse(also with referenced schemas),Create,FromAvro,FromValue,FromItems,InferFromJson, canonical form, fingerprints,Compare,CheckCompatibility - Added
Avro2JsonEncoding/JsonEncoding2Avro: JSON Encoding of the Avro specification (#156) - Added logical types
timestamp-nanos,local-timestamp-*,big-decimal,uuidonfixed;AvroConvertOptions.DateTimeRepresentation(#153) - Added
zstandardcodec - Added support for recursive types
- Added support for
ExpandoObject(#112),DeserializeHeadless<dynamic>(#107) and unions of records read intoobject/dynamic(#174) - Added reading records into
Dictionary<string, object>(#197) - Added support for map keys convertible from string (
Dictionary<Uri, T>) and dictionary types other thanDictionary<,> - Added
Serializeoverloads taking anAvroSchema, headermetadataandAvroConvert.GetMetadata(#196) - Added
Deserialize(byte[], Type, options),DeserializeHeadless<T>(ReadOnlySpan<byte>, …),Json2Avro(json, options);DeserializeHeadlesstakes reader schema, options,numberOfRowsand a runtime type [AvroFixed]public: abyte[]as a namedfixed; on adecimal, adecimalonfixednullin[AvroUnion]sets the position of the null branch:[AvroUnion(typeof(int), null)] int?→["int", "null"]Avro2Json(file, schema)resolves the data to the given schema as a reader schema- Values of type
object(Dictionary<string, object>,objectmembers,List<object>,ExpandoObject) take their schema from the written values Serialize<object>(items)writes items of different types as a union- Union branch chosen by the exact type of the value first; a dictionary,
ExpandoObjectorJObjectgoes to the record that takes all its keys - Writing with a given schema fills fields missing in the value with their defaults
- Schema resolution:
string↔bytespromotion, field and record aliases, union records matched by name or alias - Schemas keep attributes the specification does not define (e.g. Iceberg
field-id), unknown logical types and enum aliases - Reads files of Apache.Avro for C# with a logical type on a
fixedor anenum DateTimereads and writesdate,TimeSpantime-millis/time-micros(Apache.Avroavrogenclasses); dates instringfields as ISO 8601 text (Chr.Avro)GenerateModelclasses give back the source schema; supportsfixed, unions of any branches, nested arrays and maps, C# keywords, defaults, several schemas in one file- Deep data, schemas without an end and reference cycles throw instead of ending the process with a stack overflow
- Optional licence declaration:
AvroConvert.LicenseorAVROCONVERT_LICENSE - Fix for
Mergelosing data after the first block;Mergekeeps the writer schema, rejects files with different schemas, readsSingleArrayfiles - Fix for
OpenDeserializer<ExpandoObject>and for empty arrays inOpenDeserializer - Fix for
GetSchema(path)on read-only and locked files - Fix for one-element and nested collections (
List<List<T>>) - Fix for
NamingPolicyon deserialization - Fix for
MemoryStreamnot disposed inSerializeHeadless(#163) - Dependencies: Newtonsoft.Json, IronSnappy, ZstdSharp.Port