Skip to content

Commit 7967256

Browse files
Copilotbaywet
andcommitted
Initial commit - fix build errors with string.Split ambiguity
Co-authored-by: baywet <[email protected]>
1 parent ed6df9f commit 7967256

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "8.0.406"
3+
"version": "8.0.115"
44
}
55
}

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ private static string ConvertByteArrayToString(byte[] hash)
589589
// Enables setting the complete JSON path for nested subschemas e.g. #/components/schemas/person/properties/address
590590
if (useExternal)
591591
{
592-
var relPathSegment = referenceV3.Split(['#'], StringSplitOptions.RemoveEmptyEntries)[1];
592+
var relPathSegment = referenceV3.Split(new char[] {'#'}, StringSplitOptions.RemoveEmptyEntries)[1];
593593
relativePath = $"#{relPathSegment}";
594594
}
595595
else
@@ -625,7 +625,7 @@ private static bool IsSubComponent(string reference)
625625

626626
if (fragment.StartsWith("/components/schemas/", StringComparison.OrdinalIgnoreCase))
627627
{
628-
var segments = fragment.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
628+
var segments = fragment.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
629629

630630
// Expect exactly 3 segments for root-level schema: ["components", "schemas", "person"]
631631
// Anything longer means it's a subcomponent.

src/Microsoft.OpenApi/Models/OpenApiReference.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,10 @@ internal void SetJsonPointerPath(string pointer, string nodeLocation)
329329
private static string ResolveRelativePointer(string nodeLocation, string relativeRef)
330330
{
331331
// Convert nodeLocation to path segments
332-
var segments = nodeLocation.TrimStart('#').Split(['/'], StringSplitOptions.RemoveEmptyEntries).ToList();
332+
var segments = nodeLocation.TrimStart('#').Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries).ToList();
333333

334334
// Convert relativeRef to dynamic segments
335-
var relativeSegments = relativeRef.TrimStart('#').Split(['/'], StringSplitOptions.RemoveEmptyEntries);
335+
var relativeSegments = relativeRef.TrimStart('#').Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
336336

337337
// Locate the first occurrence of relativeRef segments in the full path
338338
for (int i = 0; i <= segments.Count - relativeSegments.Length; i++)

src/Microsoft.OpenApi/Services/OpenApiWorkspace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public bool Contains(string location)
347347

348348
if (uri is not null)
349349
{
350-
pathSegments = uri.Fragment.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
350+
pathSegments = uri.Fragment.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
351351

352352
// Build the base path for the root schema: "#/components/schemas/person"
353353
var fragment = OpenApiConstants.ComponentsSegment + ReferenceType.Schema.GetDisplayName() + ComponentSegmentSeparator + pathSegments[3];

0 commit comments

Comments
 (0)