Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/LEGO.AsyncAPI.Readers/AsyncApiYamlDocumentReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public AsyncApiDocument Read(YamlDocument input, out AsyncApiDiagnostic diagnost
return document;
}

public async Task<ReadResult> ReadAsync(YamlDocument input)
public Task<ReadResult> ReadAsync(YamlDocument input)
{
var diagnostic = new AsyncApiDiagnostic();
var context = new ParsingContext(diagnostic)
Expand Down Expand Up @@ -102,11 +102,11 @@ public async Task<ReadResult> ReadAsync(YamlDocument input)
}
}

return new ReadResult
return Task.FromResult(new ReadResult
{
AsyncApiDocument = document,
AsyncApiDiagnostic = diagnostic,
};
});
}

private void ResolveReferences(AsyncApiDiagnostic diagnostic, AsyncApiDocument document)
Expand Down
16 changes: 11 additions & 5 deletions src/LEGO.AsyncAPI.Readers/V2/AsyncApiDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,21 @@ public static IAsyncApiAny LoadAny(ParseNode node)

private static IAsyncApiExtension LoadExtension(string name, ParseNode node)
{
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser))
try
{
return parser(
AsyncApiAnyConverter.GetSpecificAsyncApiAny(node.CreateAny()));
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser))
{
return parser(
AsyncApiAnyConverter.GetSpecificAsyncApiAny(node.CreateAny()));
}
}
else
catch (AsyncApiException ex)
{
return AsyncApiAnyConverter.GetSpecificAsyncApiAny(node.CreateAny());
ex.Pointer = node.Context.GetLocation();
node.Context.Diagnostic.Errors.Add(new AsyncApiError(ex));
}

return AsyncApiAnyConverter.GetSpecificAsyncApiAny(node.CreateAny());
}

private static string LoadString(ParseNode node)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace LEGO.AsyncAPI.Readers

internal static partial class AsyncApiV2Deserializer
{
private static readonly FixedFieldMap<AsyncApiSchema> schemaFixedFields = new()
private static readonly FixedFieldMap<AsyncApiSchema> schemaFixedFields = new ()
{
{
"title", (a, n) => { a.Title = n.GetScalarValue(); }
Expand Down
Loading