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(
131
131
}
132
132
else if ( id . StartsWith ( "/paths/" ) )
133
133
{
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 )
136
136
{
137
137
// The reference of a path may contain JSON escape character ~1 for the forward-slash character, replace this otherwise
138
138
// the reference cannot be resolved.
139
- id = localSegments [ 2 ] . Replace ( "~1" , "/" ) ;
139
+ id = localSegments [ 1 ] . Replace ( "~1" , "/" ) ;
140
140
}
141
141
else
142
142
{
Original file line number Diff line number Diff line change @@ -447,14 +447,11 @@ internal void Walk(OpenApiPathItem pathItem)
447
447
448
448
_visitor . Visit ( pathItem ) ;
449
449
450
- if ( pathItem != null )
450
+ // The path may be a reference
451
+ if ( pathItem != null && ! ProcessAsReference ( pathItem ) )
451
452
{
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 ) ;
458
455
}
459
456
_visitor . Visit ( pathItem as IOpenApiExtensible ) ;
460
457
You can’t perform that action at this time.
0 commit comments