Skip to content

Commit e833d1b

Browse files
committed
ISSUE-1228: Change char array to static readonly for path separator character
1 parent c329b37 commit e833d1b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Microsoft.OpenApi.Readers/V3/OpenApiV3VersionService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal class OpenApiV3VersionService : IOpenApiVersionService
2121
{
2222
public OpenApiDiagnostic Diagnostic { get; }
2323

24+
private static readonly char[] _pathSeparator = new char[] { '/' };
25+
2426
/// <summary>
2527
/// Create Parsing Context
2628
/// </summary>
@@ -131,7 +133,7 @@ public OpenApiReference ConvertToOpenApiReference(
131133
}
132134
else if (id.StartsWith("/paths/"))
133135
{
134-
var localSegments = segments[1].Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
136+
var localSegments = segments[1].Split(_pathSeparator, StringSplitOptions.RemoveEmptyEntries);
135137
if (localSegments.Length == 2)
136138
{
137139
// The reference of a path may contain JSON escape character ~1 for the forward-slash character, replace this otherwise

0 commit comments

Comments
 (0)