Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde3531b

Browse files
authored
Merge pull request#2432 from microsoft/fix/extraneous-loop-methods
fix: removes loop methods from parsing context as its available in loop detector instead
2 parents5a055f9 +18a8cbe commitde3531b

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

‎src/Microsoft.OpenApi/Reader/ParsingContext.cs‎

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public class ParsingContext
1919
privatereadonlyStack<string>_currentLocation=new();
2020
privatereadonlyDictionary<string,object>_tempStorage=new();
2121
privatereadonlyDictionary<object,Dictionary<string,object>>_scopedTempStorage=new();
22-
privatereadonlyDictionary<string,Stack<string>>_loopStacks=new();
2322

2423
/// <summary>
2524
/// Extension parsers
@@ -219,53 +218,6 @@ public void StartObject(string objectName)
219218
{
220219
_currentLocation.Push(objectName);
221220
}
222-
223-
/// <summary>
224-
/// Maintain history of traversals to avoid stack overflows from cycles
225-
/// </summary>
226-
/// <param name="loopId">Any unique identifier for a stack.</param>
227-
/// <param name="key">Identifier used for current context.</param>
228-
/// <returns>If method returns false a loop was detected and the key is not added.</returns>
229-
publicboolPushLoop(stringloopId,stringkey)
230-
{
231-
if(!_loopStacks.TryGetValue(loopId,outvarstack))
232-
{
233-
stack=new();
234-
_loopStacks.Add(loopId,stack);
235-
}
236-
237-
if(!stack.Contains(key))
238-
{
239-
stack.Push(key);
240-
returntrue;
241-
}
242-
else
243-
{
244-
returnfalse;// Loop detected
245-
}
246-
}
247-
248-
/// <summary>
249-
/// Reset loop tracking stack
250-
/// </summary>
251-
/// <param name="loopid">Identifier of loop to clear</param>
252-
internalvoidClearLoop(stringloopid)
253-
{
254-
_loopStacks[loopid].Clear();
255-
}
256-
257-
/// <summary>
258-
/// Exit from the context in cycle detection
259-
/// </summary>
260-
/// <param name="loopid">Identifier of loop</param>
261-
publicvoidPopLoop(stringloopid)
262-
{
263-
if(_loopStacks[loopid].Count>0)
264-
{
265-
_loopStacks[loopid].Pop();
266-
}
267-
}
268-
269221
privatevoidValidateRequiredFields(OpenApiDocumentdoc,stringversion)
270222
{
271223
if((version.is2_0()||version.is3_0())&&(doc.Paths==null)&&RootNodeis notnull)

‎test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,6 @@ namespace Microsoft.OpenApi.Reader
19931993
public Microsoft.OpenApi.OpenApiDocument Parse(System.Text.Json.Nodes.JsonNode jsonNode, System.Uri location) { }
19941994
public T? ParseFragment<T>(System.Text.Json.Nodes.JsonNode jsonNode, Microsoft.OpenApi.OpenApiSpecVersion version, Microsoft.OpenApi.OpenApiDocument openApiDocument)
19951995
where T : Microsoft.OpenApi.IOpenApiElement { }
1996-
public void PopLoop(string loopid) { }
1997-
public bool PushLoop(string loopId, string key) { }
19981996
public void SetTempStorage(string key, object? value, object? scope = null) { }
19991997
public void StartObject(string objectName) { }
20001998
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp