AsyncAPI.NET provides a .NET object model for AsyncAPI documents, JSON/YAML readers and writers, and protocol bindings.
It supports AsyncAPI 2.x and 3.x. V2 documents are upgraded to the V3-shaped model when read and can be written back as V2. Serialization currently emits 2.6 or 3.1.0; the V3 selector is still named AsyncApiVersion.AsyncApi3_0.
See the documentation site for guides and examples, or the changelog for release notes.
Install the core model and serializers, plus the readers for JSON/YAML input:
dotnet add package ByteBard.AsyncAPI.NET
dotnet add package ByteBard.AsyncAPI.NET.ReadersFor protocol bindings, also install:
dotnet add package ByteBard.AsyncAPI.NET.BindingsBinding readers require explicit registration; see protocol bindings.
Parse YAML, check diagnostics, and write JSON (C# 11 or later):
using System;
using ByteBard.AsyncAPI;
using ByteBard.AsyncAPI.Models;
using ByteBard.AsyncAPI.Readers;
var source = """
asyncapi: 3.1.0
info:
title: Example API
version: 1.0.0
channels: {}
""";
var document = new AsyncApiStringReader().Read(source, out var diagnostics);
foreach (var error in diagnostics.Errors)
Console.Error.WriteLine($"Error at {error.Pointer}: {error.Message}");
foreach (var warning in diagnostics.Warnings)
Console.Error.WriteLine($"Warning at {warning.Pointer}: {warning.Message}");
if (diagnostics.Errors.Count > 0)
return;
Console.WriteLine(document.SerializeAsJson(AsyncApiVersion.AsyncApi3_0));- Getting started
- Reading documents and diagnostics
- Schemas: JSON Schema and Avro
- References and resolution
- Protocol bindings
- Extending: extension parsers, schema parsers, bindings, and validation rules
Contributions and suggestions are welcome. See CONTRIBUTING.md and the documentation development instructions.