You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
Alex Wichmann edited this page May 25, 2025
·
3 revisions
The AsyncAPI.NET library is a document object model (DOM) for an AsyncAPI description document.
It provides a set of classes for constructing semantically valid AsyncAPI specifications.
The library also includes a writer for serializing the DOM into JSON or YAML AsyncAPI specifications
Getting started
varmyFirstAsyncApi=newAsyncApiDocument{Info=newAsyncApiInfo{Title="my first asyncapi",Version="1.0.0",},Channels=newDictionary<string,AsyncApiChannel>{{"UserSignup",newAsyncApiChannel{Address="user/signedUp",Messages=newDictionary<string,AsyncApiMessage>(){{"UserMessage",newAsyncApiMessage{Payload=newAsyncApiJsonSchema(){Type=SchemaType.Object,Properties=newDictionary<string,AsyncApiJsonSchema>(){{"displayName",newAsyncApiJsonSchema(){Type=SchemaType.String,Description="Name of the user",}},},},}},},}},},Operations=newDictionary<string,AsyncApiOperation>(){{"ConsumerUserSignups",newAsyncApiOperation{Action=AsyncApiAction.Receive,Channel=newAsyncApiChannelReference("#/channels/UserSignup"),}},},};varyamlV2=myFirstAsyncApi.SerializeAsYaml(AsyncApiVersion.AsyncApi2_0);// asyncapi: 2.6.0// info:// title: my first asyncapi// version: 1.0.0// channels:// user/signedUp:// publish:// message:// payload:// type: object// properties:// displayName:// type: string// description: Name of the uservaryamlV3=myFirstAsyncApi.SerializeAsYaml(AsyncApiVersion.AsyncApi3_0);// asyncapi: 3.0.0// info:// title: my first asyncapi// version: 1.0.0// channels:// UserSignup:// address: user/signedUp// messages:// UserMessage:// payload:// type: object// properties:// displayName:// type: string// description: Name of the user// operations:// ConsumerUserSignups:// action: receive// channel:// $ref: '#/channels/UserSignup'// components: { }