Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The AsyncAPI.NET SDK contains a useful object model for AsyncAPI documents in .NET

License

NotificationsYou must be signed in to change notification settings

LEGO/AsyncAPI.NET

Repository files navigation

AsyncAPI.NET

GitHub Workflow Status

The AsyncAPI.NET SDK contains a useful object model for the AsyncAPI specification in .NET along with common serializers to extract raw AsyncAPI JSON and YAML documents from the model as well.

CHANGELOG
Wiki and getting started guide

Installation

Install the NuGet packages:

AsyncAPI.NET

Nuget
Nuget

AsyncAPI.Readers

Nuget
Nuget

AsyncAPI.Bindings

Nuget
Nuget

Example Usage

Main classes to know:

  • AsyncApiStringReader
  • AsyncApiStringWriter
    • There is an extension on the AsyncApiDocument type which allows Serializing as well (new AsyncApiDocument().SerializeAsJson() ornew AsyncApiDocument().SerializeAsYaml()

Writing

varmyFirstAsyncApi=newAsyncApiDocument{Info=newAsyncApiInfo{Title="my first asyncapi"},Channels=newDictionary<string,AsyncApiChannel>{{"users",newAsyncApiChannel{Subscribe=newAsyncApiOperation{OperationId="users",Description="my users channel"}}}}};varyaml=myFirstAsyncApi.SerializeAsYaml();//asyncapi: '2.5.0'//  info://    title: my first asyncapi//  channels://    users://      subscribe://        operationId: users//        description: my users channel

Reading

varhttpClient=newHttpClient{BaseAddress=newUri("https://raw.githubusercontent.com/asyncapi/spec/"),};varstream=awaithttpClient.GetStreamAsync("master/examples/streetlights-kafka.yml");varasyncApiDocument=newAsyncApiStreamReader().Read(stream,outvardiagnostic);

Bindings

To add support for reading bindings, simply add the bindings you wish to support, to theBindings collection ofAsyncApiReaderSettings.There is a nifty helper to add different types of bindings, or like in the exampleAll of them.

varsettings=newAsyncApiReaderSettings();settings.Bindings=BindingsCollection.All;varasyncApiDocument=newAsyncApiStringReader(settings).Read(stream,outvardiagnostic);

Attribution

Contribution

This project welcomes contributions and suggestions.Do you want to contribute to the project? Find out howhere.

License

Modified Apache 2.0 (Section 6)

About

The AsyncAPI.NET SDK contains a useful object model for AsyncAPI documents in .NET

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors17

Languages


[8]ページ先頭

©2009-2025 Movatter.jp