-
-
Notifications
You must be signed in to change notification settings - Fork 1
Reading
The AsyncApiReader is a component in the .NET library that can be used to deserialize AsyncAPI specifications from either JSON or YAML formats. The deserialized AsyncAPI document can then be manipulated in memory as a C# object.
To use any of the AsyncApiReaders, you first need to create an instance.
There are 3 types of readers, which all have the same API
AsyncApiStringReaderAsyncApiStreamReaderAsyncApiTextReader
To use any of the AsyncApiReaders, you first need to create an instance.
var reader = new AsyncApiStringReader();
var doc = reader.Read(yaml, out var diagnostic);You can override default reader settings by passing in an AsyncApiReaderSettings object.
or overriding settings
var settings = new AsyncApiReaderSettings();
var reader = new AsyncApiStringReader(settings);When calling .Read() the reader will output any and all Diagnostics errors and warnings. These can be both from Serialization errors/warnings (if the specification is not proper json/yaml) or from validation errors/warnings
All diagnostic messages will contain a pointer to what failed, see example under ValidationRules