Skip to content

Commit 757b9e5

Browse files
committed
Update test for new behavior and fix a warning in swift 5.0+ compiler code
1 parent bf25e7d commit 757b9e5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Sources/RefResolver.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import Foundation
22

33
func urlSplitFragment(url: String) -> (String, String) {
4+
#if swift(>=5.0)
5+
guard let hashIndex = url.firstIndex(of: "#") else {
6+
return (url, "")
7+
}
8+
#else
49
guard let hashIndex = url.index(of: "#") else {
510
return (url, "")
611
}
12+
#endif
713

814
return (
915
String(url.prefix(upTo: hashIndex)),

Tests/JSONSchemaTests/Validation/TestRequired.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public let testRequired: ((ContextType) -> Void) = {
2121
let error = errors[0]
2222

2323
try expect(error.description) == "Required property 'test' is missing"
24-
try expect(error.instanceLocation.path) == "/0"
24+
try expect(error.instanceLocation.path) == "/0/test"
2525
try expect(error.keywordLocation.path) == "#/items/required"
2626
}
2727
}

0 commit comments

Comments
 (0)