@@ -19,7 +19,6 @@ public class ParsingContext
19
19
private readonly Stack < string > _currentLocation = new ( ) ;
20
20
private readonly Dictionary < string , object > _tempStorage = new ( ) ;
21
21
private readonly Dictionary < object , Dictionary < string , object > > _scopedTempStorage = new ( ) ;
22
- private readonly Dictionary < string , Stack < string > > _loopStacks = new ( ) ;
23
22
24
23
/// <summary>
25
24
/// Extension parsers
@@ -219,53 +218,6 @@ public void StartObject(string objectName)
219
218
{
220
219
_currentLocation . Push ( objectName ) ;
221
220
}
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
- public bool PushLoop ( string loopId , string key )
230
- {
231
- if ( ! _loopStacks . TryGetValue ( loopId , out var stack ) )
232
- {
233
- stack = new ( ) ;
234
- _loopStacks . Add ( loopId , stack ) ;
235
- }
236
-
237
- if ( ! stack . Contains ( key ) )
238
- {
239
- stack . Push ( key ) ;
240
- return true ;
241
- }
242
- else
243
- {
244
- return false ; // 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
- internal void ClearLoop ( string loopid )
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
- public void PopLoop ( string loopid )
262
- {
263
- if ( _loopStacks [ loopid ] . Count > 0 )
264
- {
265
- _loopStacks [ loopid ] . Pop ( ) ;
266
- }
267
- }
268
-
269
221
private void ValidateRequiredFields ( OpenApiDocument doc , string version )
270
222
{
271
223
if ( ( version . is2_0 ( ) || version . is3_0 ( ) ) && ( doc . Paths == null ) && RootNode is not null )
0 commit comments