/// <summary>
 /// Adds a segment to the context path to enable pointing to the current location in the document.
 /// </summary>
 /// <param name="comparisonContext">The context under which to compare the objects.</param>
 /// <param name="segment">An identifier for the segment.</param>
 /// <param name="compare">An action that compares objects within the context.</param>
 protected virtual void WalkAndCompare(
     ComparisonContext comparisonContext,
     string segment,
     Action compare)
 {
     comparisonContext.Enter(segment.Replace("~", "~0").Replace("/", "~1"));
     compare();
     comparisonContext.Exit();
 }
 /// <summary>
 /// Adds a segment to the context path to enable pointing to the current location in the document.
 /// </summary>
 /// <param name="comparisonContext">The context under which to compare the objects.</param>
 /// <param name="segment">An identifier for the segment.</param>
 /// <param name="openApiDifference">The open api difference to add.</param>
 internal void WalkAndAddOpenApiDifference(
     ComparisonContext comparisonContext,
     string segment,
     OpenApiDifference openApiDifference)
 {
     comparisonContext.Enter(segment.Replace("~", "~0").Replace("/", "~1"));
     openApiDifference.Pointer = comparisonContext.PathString;
     comparisonContext.AddOpenApiDifference(openApiDifference);
     comparisonContext.Exit();
 }