dry-rb / dry-logic

Predicate logic with rule composition
https://dry-rb.org/gems/dry-logic/
MIT License
179 stars 66 forks source link

Fix issue if we send not string to format? #89

Closed MaximeRVY closed 2 years ago

MaximeRVY commented 2 years ago

Hi there,

I find an issue in dry-validation related to this repo.

If we do:

required(:id).filled(:uuid_v4?)

instead of

required(:id).value(:string, :uuid_v4?)

It raise an error when someone send an integer with this error: TypeError: no implicit conversion of Integer into String

So I'm wondering if we can add str?(input) in the format? method.

What do you think ?

Thanks a lot

flash-gordon commented 2 years ago

This is definitely intentional :) The fact that type checks can be skipped is actually an overlook we're going to fix in dry-schema 2.0, there you'll have to be explicit about types expected.