You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 aport
value, it would be nice to be able to saymin: 1
andmax: 65535
, or a regex for some string values.So what I have in mind right now was exactly that.
min
andmax
forinteger
andfloat
andregex
or however called forstring
.enum
,list
, andboolean
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.
The text was updated successfully, but these errors were encountered: