dashbitco / nimble_options

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

Add option for `accepted_values` or `allowed_values` ? #30

Closed praveenperera closed 4 years ago

praveenperera commented 4 years ago

What do you think about having an option to validate against and set number of options?

For example:

definition = [
  status: [
    type: :atom,
    allowed_values: [:waiting, :started, :finished],
    default: :waiting
  ],
]
wojtekmach commented 4 years ago

this is already supported via :one_of, e.g.:

batch_mode: [type: {:one_of, [:flush, :bulk]}]]