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

Provide more builtin CustomChecks #247

Open
JelleZijlstra opened this issue Nov 5, 2021 · 1 comment
Open

Provide more builtin CustomChecks #247

JelleZijlstra opened this issue Nov 5, 2021 · 1 comment

Comments

@JelleZijlstra
Copy link
Contributor

Ideas:

  • NoAny: disallow Any in the passed in type. Could be either "shallow" (disallow only Any itself, and VariableNameValue) or "deep" (recurse into the Value with .walk_values() and error if there's Any anywhere).
  • RestrictedLiteral: like LiteralOnly, but adds a callback function that can reject a value. For example, Spark jobs can take a string representing how much memory they accept in the form 123g. The callback could check that the passed in value is a string consisting of a number plus g. We could allow the function to return a bool, a str (error message) or an ErrorMessage object.
@JelleZijlstra
Copy link
Contributor Author

We could also provide a JSONCompatible check that recurses into values and checks they are JSON-compatible (float, int, null, string, bool, lists or dicts of other JSON-compatible things).

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

1 participant