konform-kt / konform

Portable validations for Kotlin
https://www.konform.io
MIT License
651 stars 39 forks source link

hasSize not working as expected #24

Closed 1gravity closed 3 years ago

1gravity commented 3 years ago

My expectation for hasSize(100) is that the property is exactly 100 characters long but the function is defined like this: hasSize(min: Int = Int.MIN_VALUE, max: Int = Int.MAX_VALUE) which translates to hasSize(100, Int.MAX_VALUE). I think there should be a one parameter function hasSize(size: Int) to prevent these misunderstandings and the two parameter function should not have default values for min/max.

nlochschmidt commented 3 years ago

Thank you for the feedback @1gravity, but could you check where hasSize is coming from? Because it's not part of konform 😅. Konform contains JSONSchema style validations minItems and maxItems instead.

1gravity commented 3 years ago

Lol, sorry for that. Wrong validation library. You can close the issue