File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
Microsoft.OpenApi.Readers/V3
Microsoft.OpenApi/Services Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -131,12 +131,12 @@ public OpenApiReference ConvertToOpenApiReference(
131131 }
132132 else if ( id . StartsWith ( "/paths/" ) )
133133 {
134- var localSegments = segments [ 1 ] . Split ( '/' ) ;
135- if ( localSegments . Length == 3 )
134+ var localSegments = segments [ 1 ] . Split ( new char [ ] { '/' } , StringSplitOptions . RemoveEmptyEntries ) ;
135+ if ( localSegments . Length == 2 )
136136 {
137137 // The reference of a path may contain JSON escape character ~1 for the forward-slash character, replace this otherwise
138138 // the reference cannot be resolved.
139- id = localSegments [ 2 ] . Replace ( "~1" , "/" ) ;
139+ id = localSegments [ 1 ] . Replace ( "~1" , "/" ) ;
140140 }
141141 else
142142 {
Original file line number Diff line number Diff line change @@ -447,14 +447,11 @@ internal void Walk(OpenApiPathItem pathItem)
447447
448448 _visitor . Visit ( pathItem ) ;
449449
450- if ( pathItem != null )
450+ // The path may be a reference
451+ if ( pathItem != null && ! ProcessAsReference ( pathItem ) )
451452 {
452- // The path may be a reference
453- if ( ! ProcessAsReference ( pathItem ) )
454- {
455- Walk ( OpenApiConstants . Parameters , ( ) => Walk ( pathItem . Parameters ) ) ;
456- Walk ( pathItem . Operations ) ;
457- }
453+ Walk ( OpenApiConstants . Parameters , ( ) => Walk ( pathItem . Parameters ) ) ;
454+ Walk ( pathItem . Operations ) ;
458455 }
459456 _visitor . Visit ( pathItem as IOpenApiExtensible ) ;
460457
You can’t perform that action at this time.
0 commit comments