Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other useful validations #308

Open
jsshapiro opened this issue Mar 21, 2021 · 1 comment
Open

Other useful validations #308

jsshapiro opened this issue Mar 21, 2021 · 1 comment

Comments

@jsshapiro
Copy link

The discussion about regexp keys got me thinking about two other things that would be really useful:

Regexp validator

Add /regexp/ as a matching criteria, with the intended meaning that:

key: /regexp/

permits any string value whose undelimited form matches the regexp.

Procedure validator

Permit a lambda expression (val) => boolean as a matchable type, with the intended meaning that the boolean, number, [undelimited] string, list, or structure value read is passed to the function, and is accepted exactly if the function returns true. This enables some very interesting filtering without adding much complexity to the core implementation. In particular, it would enable a sophisticated matcher to implement things like:

  • Accept only specific number values
  • Check a structure using a (nested) yaml-validator, but then confirm that co-required keys or mutually-exclusive keys are not present.

Unfortunately, I suspect that either of these takes us past what check-type can do.

Thoughts?

@paazmaya
Copy link
Owner

This would be definetly something that should be added, as it is very useful, but I am currently not actively using this for anything, hence asking if you would be willing to work on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants