dry-rb / dry-logic

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

Change argument name in the "size?" method to "num" #72

Closed tadeusz-niemiec closed 4 years ago

tadeusz-niemiec commented 4 years ago

Fixes dry-rb/dry-schema#290

This resolves the issue with inconsistency in the names of interpolated arguments when using translations for dry-schema/dry-validation messages. Now every interpolated argument is called "num" in all "size" connected validations: "size?", "min_size?", "max_size?".

This was happening because dry-schema calls predicate.parameters and uses them to get names of interpolated args in error messages

Btw wasn't sure if this should be "num" or "size". I chose "num" because it will be backward compatible but on the other hand it's less obvious...

solnic commented 4 years ago

@tadeusz-niemiec great catch! thank you ❤️

solnic commented 4 years ago

@tadeusz-niemiec ...oops, it actually broke a lot of stuff in dry-schema so I'm afraid we can't fix it like that. I had to revert this :(

tadeusz-niemiec commented 4 years ago

@solnic this one fixes failing tests in the dry-schema: https://github.com/dry-rb/dry-schema/pull/291