TNG / ngqp

Declaratively synchronize form controls with the URL

Home Page:https://tng.github.io/ngqp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restrict / Validate deserialized values

Airblader opened this issue · comments

What's your idea?

A common use-case is that there's only a discrete set of possible values for a parameter, but validating this is currently only possible by providing a custom deserializer which can then convert invalid values into some fallback value or similar.

We should evaluate whether a more direct approach for this could be useful, and if so, what it could look like. Some ideas:

  1. Make baking this into a deserializer easier through some factory method.
  2. Provide a restrictTo kind of option which requires & uses the already existing compareWith function
  3. Provide a separate validation function
  4. …?