AvroSchemaGenerator 2.10.0
dotnet add package AvroSchemaGenerator --version 2.10.0
NuGet\Install-Package AvroSchemaGenerator -Version 2.10.0
<PackageReference Include="AvroSchemaGenerator" Version="2.10.0" />
<PackageVersion Include="AvroSchemaGenerator" Version="2.10.0" />
<PackageReference Include="AvroSchemaGenerator" />
paket add AvroSchemaGenerator --version 2.10.0
#r "nuget: AvroSchemaGenerator, 2.10.0"
#:package AvroSchemaGenerator@2.10.0
#addin nuget:?package=AvroSchemaGenerator&version=2.10.0
#tool nuget:?package=AvroSchemaGenerator&version=2.10.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; }
}
Custom Avro Definition
public class CustomDefinition
{
[AvroSchema("{\n" +
" \"type\": \"bytes\",\n" +
" \"logicalType\": \"decimal\",\n" +
" \"precision\": 10,\n" +
" \"scale\": 6\n" +
"}")]
public AvroDecimal DecimalAvro { 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
License
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 8.0.0)
-
net7.0
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 8.0.0)
-
net8.0
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 8.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on AvroSchemaGenerator:
Package | Downloads |
---|---|
Pulsar.Client
.NET client library for Apache Pulsar |
|
Pulsar.Client.Otel
OpenTelemetry plugin for Pulsar.Client |
|
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.10.0 | 109,902 | 12/16/2023 |
2.9.2 | 628,759 | 7/10/2023 |
2.9.1 | 1,514 | 3/19/2023 |
2.9.0 | 561 | 2/4/2023 |
2.9.0-rc.39 | 194 | 2/3/2023 |
2.9.0-rc.15 | 195 | 1/9/2023 |
2.9.0-rc.6 | 183 | 1/9/2023 |
2.8.1 | 107,453 | 1/9/2023 |
2.8.0 | 426 | 12/24/2022 |
2.8.0-rc.22 | 181 | 12/24/2022 |
2.8.0-rc.21 | 185 | 12/24/2022 |
2.8.0-rc.13 | 177 | 12/24/2022 |
2.8.0-rc.6 | 180 | 12/24/2022 |
2.7.0 | 237,164 | 7/20/2022 |
2.7.0-rc.139 | 208 | 7/20/2022 |
2.7.0-rc.138 | 200 | 7/20/2022 |
2.6.0 | 181,860 | 2/20/2022 |
2.6.0-rc.136 | 220 | 7/19/2022 |
2.5.2-alpha.2 | 241 | 1/16/2022 |
2.5.2-Alpha.1 | 222 | 1/16/2022 |
2.5.1 | 426 | 1/13/2022 |
2.5.0 | 535 | 12/26/2021 |
2.4.1 | 1,335 | 10/27/2021 |
2.4.0 | 54,357 | 9/28/2021 |
2.4.0-beta | 347 | 9/28/2021 |
2.3.3 | 1,010 | 9/15/2021 |
2.3.3-beta | 358 | 9/15/2021 |
2.3.2 | 446 | 9/15/2021 |
2.3.1-beta | 355 | 9/15/2021 |
2.3.0 | 492 | 9/15/2021 |
2.2.0 | 811 | 9/13/2021 |
2.2.0-beta.17 | 284 | 9/13/2021 |
2.1.0 | 843 | 9/11/2021 |
2.1.0-beta.16 | 307 | 9/13/2021 |
2.1.0-beta.15 | 351 | 9/11/2021 |
2.0.0 | 862 | 9/10/2021 |
2.0.0-beta.14 | 290 | 9/9/2021 |
1.9.0 | 54,506 | 4/14/2021 |
1.9.0-beta.13 | 312 | 9/9/2021 |
1.9.0-beta.12 | 292 | 4/14/2021 |
1.9.0-beta.11 | 271 | 4/14/2021 |
1.9.0-beta.10 | 281 | 4/13/2021 |
1.9.0-beta.9 | 275 | 4/13/2021 |
1.9.0-beta.5 | 259 | 4/13/2021 |
1.9.0-beta.3 | 258 | 4/13/2021 |
1.9.0-beta.2 | 301 | 4/11/2021 |
1.8.0 | 175,680 | 12/10/2020 |
1.7.0 | 708 | 11/4/2020 |
1.6.0 | 60,129 | 6/26/2020 |
1.5.4 | 602 | 6/21/2020 |
1.5.3 | 6,376 | 5/27/2020 |
1.5.2 | 4,886 | 5/13/2020 |
1.5.1 | 1,282 | 5/13/2020 |
1.5.0 | 593 | 5/13/2020 |
1.4.1 | 632 | 5/11/2020 |
1.4.0 | 606 | 5/11/2020 |
1.3.0 | 1,577 | 4/30/2020 |
1.2.0 | 630 | 4/28/2020 |
1.1.0 | 921 | 4/27/2020 |
1.0.0 | 602 | 4/27/2020 |
0.1.2 | 1,657 | 4/14/2020 |
0.1.1 | 596 | 4/14/2020 |
0.1.0 | 1,345 | 4/11/2020 |
• [Add] net8.0
• [update] NUKE 7.0.6
• [Added] CODE OF CONDUCT
Full changelog at https://github.com/Sharp-Pulsar/AvroSchemaGenerator/blob/refs/tags/2.10.0/CHANGELOG.md