Skip to content

Commit c8773ba

Browse files
committed
Stopped RootNode from writing back to ParsingContext
1 parent 5078a58 commit c8773ba

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/Microsoft.OpenApi.Readers/ParseNodes/RootNode.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public RootNode(
1818
YamlDocument yamlDocument) : base(context, diagnostic)
1919
{
2020
_yamlDocument = yamlDocument;
21-
context.RootNode = this;
2221
}
2322

2423
public ParseNode Find(JsonPointer referencePointer)

test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ public void LoadSchemaReference()
2323
// Arrange
2424
var context = new ParsingContext();
2525
var diagnostic = new OpenApiDiagnostic();
26-
RootNode rootNode;
2726

2827
using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "multipleReferences.v2.yaml")))
2928
{
3029
var yamlStream = new YamlStream();
3130
yamlStream.Load(new StreamReader(stream));
3231
var yamlDocument = yamlStream.Documents.First();
3332

34-
rootNode = new RootNode(context, diagnostic, yamlDocument);
33+
context.RootNode = new RootNode(context, diagnostic, yamlDocument);
3534
}
3635

3736
context.ReferenceService = new OpenApiV2VersionService();
@@ -80,15 +79,14 @@ public void LoadParameterReference()
8079
// Arrange
8180
var context = new ParsingContext();
8281
var diagnostic = new OpenApiDiagnostic();
83-
RootNode rootNode;
8482

8583
using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "multipleReferences.v2.yaml")))
8684
{
8785
var yamlStream = new YamlStream();
8886
yamlStream.Load(new StreamReader(stream));
8987
var yamlDocument = yamlStream.Documents.First();
9088

91-
rootNode = new RootNode(context, diagnostic, yamlDocument);
89+
context.RootNode = new RootNode(context, diagnostic, yamlDocument);
9290
}
9391

9492
context.ReferenceService = new OpenApiV2VersionService();
@@ -125,15 +123,15 @@ public void LoadSecuritySchemeReference()
125123
// Arrange
126124
var context = new ParsingContext();
127125
var diagnostic = new OpenApiDiagnostic();
128-
RootNode rootNode;
126+
129127

130128
using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "multipleReferences.v2.yaml")))
131129
{
132130
var yamlStream = new YamlStream();
133131
yamlStream.Load(new StreamReader(stream));
134132
var yamlDocument = yamlStream.Documents.First();
135133

136-
rootNode = new RootNode(context, diagnostic, yamlDocument);
134+
context.RootNode = new RootNode(context, diagnostic, yamlDocument);
137135
}
138136

139137
context.ReferenceService = new OpenApiV2VersionService();
@@ -171,7 +169,7 @@ public void LoadResponseReference()
171169
yamlStream.Load(new StreamReader(stream));
172170
var yamlDocument = yamlStream.Documents.First();
173171

174-
rootNode = new RootNode(context, diagnostic, yamlDocument);
172+
context.RootNode = new RootNode(context, diagnostic, yamlDocument);
175173
}
176174

177175
context.ReferenceService = new OpenApiV2VersionService();
@@ -200,15 +198,14 @@ public void LoadResponseAndSchemaReference()
200198
// Arrange
201199
var context = new ParsingContext();
202200
var diagnostic = new OpenApiDiagnostic();
203-
RootNode rootNode;
204201

205202
using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "multipleReferences.v2.yaml")))
206203
{
207204
var yamlStream = new YamlStream();
208205
yamlStream.Load(new StreamReader(stream));
209206
var yamlDocument = yamlStream.Documents.First();
210207

211-
rootNode = new RootNode(context, diagnostic, yamlDocument);
208+
context.RootNode = new RootNode(context, diagnostic, yamlDocument);
212209
}
213210

214211
context.ReferenceService = new OpenApiV2VersionService();

0 commit comments

Comments
 (0)