AvroSchemaGenerator 2.6.0
Install-Package AvroSchemaGenerator -Version 2.6.0
dotnet add package AvroSchemaGenerator --version 2.6.0
<PackageReference Include="AvroSchemaGenerator" Version="2.6.0" />
paket add AvroSchemaGenerator --version 2.6.0
#r "nuget: AvroSchemaGenerator, 2.6.0"
// Install AvroSchemaGenerator as a Cake Addin
#addin nuget:?package=AvroSchemaGenerator&version=2.6.0
// Install AvroSchemaGenerator as a Cake Tool
#tool nuget:?package=AvroSchemaGenerator&version=2.6.0
AvroSchemaGenerator
Use to generate Avro Schema with support for RECURSIVE SCHEMA
Getting Started
Install the NuGet package AvroSchemaGenerator and copy/paste the code below
using AvroSchemaGenerator;
public class Course
{
public string Level { get; set; }
public int Year { get; set; }
public string State { get; set; }
public string Gender { get; set; }
}
var avroSchema = typeof(Course).GetSchema();
By default, AvroSchemaGenerator
generates schema with optional fields. The code below is an example of how to mark fields as required
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using AvroSchemaGenerator;
public class Course
{
[Required]
public string Level { get; set; }
[Required]
public int Year { get; set; }
[Required]
public string State { get; set; }
[Required]
public string Gender { get; set; }
}
var avroSchema = typeof(Course).GetSchema();
You can assign a default value as well
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using AvroSchemaGenerator;
public class Course
{
[DefaultValue("200")]
[Required]
public string Level { get; set; }
[Required]
public int Year { get; set; }
[DefaultValue("Closed")]
public string State { get; set; }
public string Gender { get; set; }
}
var avroSchema = typeof(Course).GetSchema();
Aliases
[Aliases("OldCourse")]
public class Course
{
[Aliases("Level")]
public string NewLevel { get; set; }
}
Logical Types
public class MessageTimeKind
{
[LogicalType(LogicalTypeKind.TimeMicrosecond)]
public TimeSpan TimeMicros { get; set; }
[LogicalType(LogicalTypeKind.TimeMillisecond)]
public TimeSpan TimeMillis { get; set; }
}
public class MessageTimestampKind
{
[LogicalType(LogicalTypeKind.TimestampMicrosecond)]
public DateTime StampMicros { get; set; }
[LogicalType(LogicalTypeKind.TimestampMillisecond)]
public DateTime StampMillis { get; set; }
}
public class MessageDateKind
{
[LogicalType(LogicalTypeKind.Date)]
public DateTime CreatedTime { get; set; }
public AvroDecimal Size { get; set; }
public string DayOfWeek { get; set; }
}
NOTE
- Don't use same declaring type as dictionary value
- Don't use same declaring type as list argument
- Dictionary key must be a string type
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 6.0.1)
-
.NETStandard 2.1
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 6.0.1)
-
net5.0
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 6.0.1)
-
net6.0
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 6.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on AvroSchemaGenerator:
Package | Downloads |
---|---|
Pulsar.Client
.NET client library for Apache Pulsar |
|
SharpPulsar
SharpPulsar is Apache Pulsar Client built using Akka.net |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.6.0 | 23,697 | 2/20/2022 |
2.5.2-alpha.2 | 69 | 1/16/2022 |
2.5.2-Alpha.1 | 61 | 1/16/2022 |
2.5.1 | 91 | 1/13/2022 |
2.5.0 | 194 | 12/26/2021 |
2.4.1 | 853 | 10/27/2021 |
2.4.0 | 14,270 | 9/28/2021 |
2.4.0-beta | 119 | 9/28/2021 |
2.3.3 | 566 | 9/15/2021 |
2.3.3-beta | 161 | 9/15/2021 |
2.3.2 | 138 | 9/15/2021 |
2.3.1-beta | 140 | 9/15/2021 |
2.3.0 | 175 | 9/15/2021 |
2.2.0 | 381 | 9/13/2021 |
2.2.0-beta.17 | 95 | 9/13/2021 |
2.1.0 | 417 | 9/11/2021 |
2.1.0-beta.16 | 124 | 9/13/2021 |
2.1.0-beta.15 | 170 | 9/11/2021 |
2.0.0 | 421 | 9/10/2021 |
2.0.0-beta.14 | 113 | 9/9/2021 |
1.9.0 | 28,686 | 4/14/2021 |
1.9.0-beta.13 | 128 | 9/9/2021 |
1.9.0-beta.12 | 100 | 4/14/2021 |
1.9.0-beta.11 | 89 | 4/14/2021 |
1.9.0-beta.10 | 87 | 4/13/2021 |
1.9.0-beta.9 | 86 | 4/13/2021 |
1.9.0-beta.5 | 73 | 4/13/2021 |
1.9.0-beta.3 | 81 | 4/13/2021 |
1.9.0-beta.2 | 127 | 4/11/2021 |
1.8.0 | 57,484 | 12/10/2020 |
1.7.0 | 392 | 11/4/2020 |
1.6.0 | 34,276 | 6/26/2020 |
1.5.4 | 270 | 6/21/2020 |
1.5.3 | 3,094 | 5/27/2020 |
1.5.2 | 1,855 | 5/13/2020 |
1.5.1 | 647 | 5/13/2020 |
1.5.0 | 270 | 5/13/2020 |
1.4.1 | 291 | 5/11/2020 |
1.4.0 | 278 | 5/11/2020 |
1.3.0 | 829 | 4/30/2020 |
1.2.0 | 270 | 4/28/2020 |
1.1.0 | 472 | 4/27/2020 |
1.0.0 | 270 | 4/27/2020 |
0.1.2 | 889 | 4/14/2020 |
0.1.1 | 282 | 4/14/2020 |
0.1.0 | 740 | 4/11/2020 |
• Add back support for NET standard 2.0
• Add IEnumerabl<> support • @ThomasHarzer [https://github.com/eaba/AvroSchemaGenerator/commit/38c38308d183ecda416ce5b8b946ebe681c2f171]
Full changelog at https://github.com/eaba/AvroSchemaGenerator/blob/main/CHANGELOG.md