Skip to content

Commit 2796de8

Browse files
authored
Report descriptive error when a type definition with type: $null_or:: cannot accept null due to a conflicting constraint (#308)
1 parent ca2e459 commit 2796de8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ion-schema/src/main/kotlin/com/amazon/ionschema/internal/CommonViolations.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ internal object CommonViolations {
2626
fun INVALID_TYPE(constraint: IonValue, value: IonValue) = Violation(
2727
constraint,
2828
"invalid_type",
29-
"not applicable for type %s".format(value.type.toString().toLowerCase())
29+
"values of type %s are never valid for types defining %s constraints".format(value.type.toString().toLowerCase(), constraint.fieldName)
3030
)
3131

3232
fun NULL_VALUE(constraint: IonValue) = Violation(
3333
constraint,
3434
"null_value",
35-
"not applicable for null values"
35+
"null values are never valid for types defining %s constraints".format(constraint.fieldName)
3636
)
3737
}

0 commit comments

Comments
 (0)