Validate

Input validation

Table 1. Available fields in blickfeld.base.Validate
Field Type Default Unit

number

NumberRules

-

-

See description at the messages above!

string

StringRules

-

-

bytes

BytesRules

-

-

repeated

RepeatedRules

-

-

map

MapRules

-

-

path

string

-

-

path to the (sub message) child field the validation shall be enforced (cf. path of a protobuf FieldMask: https://protobuf.dev/reference/java/api-docs/com/google/protobuf/FieldMask.html)

optional

bool

-

-

This field is optional if set to True

Number Rules

Number validation. Can be applied for all numbers (float, double, int32, int64, uint32, etc.) for values between -16777216 and +16777216

Table 2. Available fields in blickfeld.base.Validate.NumberRules
Field Type Default Unit

greater

double

-

-

target value has to be "Greater Than"

greater_or_equal

double

-

-

target value has to be "Greater Than or Equal"

less

double

-

-

target value has to be "Less Than"

less_or_equal

double

-

-

target value has to be "Less Than or Equal"

String Rules

String validation

Table 3. Available fields in blickfeld.base.Validate.StringRules
Field Type Default Unit

minimum

uint32

-

-

minimal number of required characters

maximum

uint32

-

-

maximal number of allowed characters

startswith

string

-

-

string has to start with this string (case sensitive)

endswith

string

-

-

string has to start with this string (case sensitive)

contains

string

-

-

string has to start with this string (case sensitive)

pattern

string

-

-

string has to match this regex pattern. The following regex match method is used: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match

Bytes Rules

Byte validation

Table 4. Available fields in blickfeld.base.Validate.BytesRules
Field Type Default Unit

minimum

uint32

-

-

minimal number of required bytes

maximum

uint32

-

-

maximal number of allowed bytes

Repeated Rules

Repeated validation: Apply only to repeated fields

Table 5. Available fields in blickfeld.base.Validate.RepeatedRules
Field Type Default Unit

minimum

uint64

-

-

minimal number of repeated list elements

maximum

uint64

-

-

maximal number of repeated list elements

Map Rules

Map validation: Apply only to map fields

Table 6. Available fields in blickfeld.base.Validate.MapRules
Field Type Default Unit

minimum

uint64

-

-

minimal number of key-value pairs

maximum

uint64

-

-

maximal number of key-value pairs

keys

Validate

-

-

(recursive) Validate definition for keys

values

Validate

-

-

(recursive) Validate definition for values