Skip to content

Commit b64e853

Browse files
committed
required validation errors show json instance location
1 parent 8c7ec15 commit b64e853

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55
let package = Package(
66
name: "JSONSchema",
77
platforms: [
8-
.macOS(.v10_13),
8+
.macOS(.v10_13), .iOS(.v11), .tvOS(.v11)
99
],
1010
products: [
1111
.library(name: "JSONSchema", targets: ["JSONSchema"]),

Sources/Validation/required.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ func required(context: Context, required: Any, instance: Any, schema: [String: A
1010

1111
return AnySequence(required.compactMap { key -> ValidationError? in
1212
guard !instance.keys.contains(key) else { return nil }
13+
context.instanceLocation.push(key)
14+
defer { context.instanceLocation.pop() }
1315
return ValidationError(
1416
"Required property '\(key)' is missing",
1517
instanceLocation: context.instanceLocation,

0 commit comments

Comments
 (0)