Skip to content

Commit ffa65b4

Browse files
committed
♻️ refactor(constraints): update value comparison to use toString method
- replace toStringOrDefaultAware with toString for value comparison - ensure consistent handling of nullable values in DisallowValues constraint
1 parent 50a6f46 commit ffa65b4

2 files changed

Lines changed: 1 addition & 14 deletions

File tree

surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/config/constraints/CollectionConstraintUtils.kt

Lines changed: 0 additions & 13 deletions
This file was deleted.

surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/config/constraints/DisallowValues.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ annotation class DisallowValues(vararg val values: String) {
1818
companion object {
1919
internal object Factory : Constraint.Factory<DisallowValues, Any?> {
2020
override fun make(data: DisallowValues, type: Type): Constraint<Any?> = { value ->
21-
if (value != null && data.values.any { it.equals(value.toStringOrDefaultAware(), ignoreCase = true) }) {
21+
if (value != null && data.values.any { it.equals(value.toString(), ignoreCase = true) }) {
2222
throw SerializationException("Value '$value' is not allowed")
2323
}
2424
}

0 commit comments

Comments
 (0)