File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
src/Microsoft.OpenApi/Models/References Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -68,20 +68,13 @@ public OpenApiTagReference? Parent
68
68
{
69
69
get
70
70
{
71
- // Prevent stack overflow by checking for self-reference
72
- var targetParent = Target ? . Parent ;
73
- if ( targetParent == null )
71
+ var target = Target ;
72
+ if ( target is OpenApiTagReference targetRef && ReferenceEquals ( targetRef . Reference , this . Reference ) )
73
+ {
74
74
return null ;
75
-
76
- // Check if the target's parent reference is the same as this reference
77
- if ( ReferenceEquals ( targetParent . Reference , this . Reference ) )
78
- return null ;
79
-
80
- // Check if the target's parent name is the same as this tag's name
81
- if ( string . Equals ( targetParent . Name , this . Name , StringComparison . OrdinalIgnoreCase ) )
82
- return null ;
83
-
84
- return targetParent ;
75
+ }
76
+
77
+ return target ? . Parent ;
85
78
}
86
79
}
87
80
You can’t perform that action at this time.
0 commit comments