dashbitco / nimble_options

A tiny library for validating and documenting high-level options. 💽
Apache License 2.0
507 stars 38 forks source link

Options schema seems to be validated for each call #69

Closed lud closed 3 years ago

lud commented 3 years ago

Hello,

What do you think about validating the schema once, so we can define an @attribute and then directly call the validation with a valid schema?

Thank you

josevalim commented 3 years ago

This is a great call. Can you please send a PR? We could have something like NimbleOptions.new!, that returns a struct with validated options and if a validated struct is given to NimbleOptions.validate, we don't validate it again.

whatyouhide commented 3 years ago

Agreed, nice idea. Let's do it 👍

lud commented 3 years ago

Hi @josevalim & @whatyouhide , this is my proposal : https://github.com/dashbitco/nimble_options/pull/70

josevalim commented 3 years ago

Beautiful, closing this in favor of the PR!