Skip to content

Commit 1df49c8

Browse files
committed
chore: remove yamldotnet from parsenodes
1 parent 71fe571 commit 1df49c8

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

src/LEGO.AsyncAPI.Readers/AsyncApiTextReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public AsyncApiDocument Read(TextReader input, out AsyncApiDiagnostic diagnostic
5454
}
5555

5656
/// <summary>
57-
/// Reads the content of the TextReader. If there are references to external documents then they will be read asynchronously.
57+
/// Reads the content of the TextReader.
5858
/// </summary>
5959
/// <param name="input">TextReader containing AsyncApi description to parse.</param>
6060
/// <returns>A ReadResult instance that contains the resulting AsyncApiDocument and a diagnostics instance.</returns>

src/LEGO.AsyncAPI.Readers/JsonHelper.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace LEGO.AsyncAPI.Readers
44
{
55
using System;
66
using System.Globalization;
7-
using System.IO;
8-
using System.Linq;
97
using System.Text.Json.Nodes;
108
using LEGO.AsyncAPI.Exceptions;
11-
using YamlDotNet.RepresentationModel;
129

1310
internal static class JsonHelper
1411
{
@@ -21,12 +18,6 @@ public static string GetScalarValue(this JsonNode node)
2118
public static JsonNode ParseJsonString(string jsonString)
2219
{
2320
return JsonNode.Parse(jsonString);
24-
var reader = new StringReader(jsonString);
25-
var yamlStream = new YamlStream();
26-
yamlStream.Load(reader);
27-
28-
var yamlDocument = yamlStream.Documents.First();
29-
return yamlDocument.RootNode.ToJsonNode();
3021
}
3122
}
3223
}

src/LEGO.AsyncAPI.Readers/ParseNodes/MapNode.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace LEGO.AsyncAPI.Readers.ParseNodes
66
using System.Collections;
77
using System.Collections.Generic;
88
using System.Linq;
9+
using System.Text.Json;
910
using System.Text.Json.Nodes;
1011
using LEGO.AsyncAPI.Models;
1112
using LEGO.AsyncAPI.Models.Interfaces;
1213
using LEGO.AsyncAPI.Readers.Exceptions;
13-
using YamlDotNet.Serialization;
1414

1515
public class MapNode : ParseNode, IEnumerable<PropertyNode>
1616
{
@@ -176,8 +176,7 @@ IEnumerator IEnumerable.GetEnumerator()
176176

177177
public override string GetRaw()
178178
{
179-
var x = new SerializerBuilder().JsonCompatible().Build();
180-
return x.Serialize(this.node);
179+
return JsonSerializer.Serialize(this.node);
181180
}
182181

183182
public T GetReferencedObject<T>(ReferenceType referenceType, string referenceId)
@@ -203,7 +202,7 @@ public string GetReferencePointer()
203202
public string GetScalarValue(ValueNode key)
204203
{
205204
var scalarNode = this.node[key.GetScalarValue()] is JsonValue jsonValue
206-
? jsonValue
205+
? jsonValue
207206
: throw new AsyncApiReaderException($"Expected scalar value while parsing {key.GetScalarValue()}", this.Context);
208207

209208
return scalarNode.GetScalarValue();

0 commit comments

Comments
 (0)