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

Validation rules for values #205

Open
Vampire opened this issue Aug 18, 2024 · 0 comments
Open

Validation rules for values #205

Vampire opened this issue Aug 18, 2024 · 0 comments

Comments

@Vampire
Copy link
Collaborator

Vampire commented Aug 18, 2024

Sometimes it would be nice to be able to specify some additional validation rules that restrict the basic types further.
For example if you use integer for a port value, it would be nice to be able to say min: 1 and max: 65535, or a regex for some string values.

So what I have in mind right now was exactly that. min and max for integer and float and regex or however called for string. enum, list, and boolean are probably already restricted enough per-se.

A consumer of the typing could then also generate according validation code.
In some languages you can define a type directly like that, other languages have annotations with such validation information, yet other languages can generate runtime validation code.

When adding this, please keep in mind to clearly document which regex flavor has to be used by both sides.

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