Pike v8.1 release 6

Method Standards.JSON.Validator()->validate_string()


Method validate_string

private string validate_string(string key, mixed value, mapping(string:mixed) schema)

Description

Verify that the specified value is a string according to the specified schema. The following properties of schema are verified:

minLength

If schema has the property "minLength", then the value must not be shorter than the specified length.

maxLength

If schema has the property "maxLength", then the value must not be longer than the specified length.

pattern

If schema has the property "pattern", then the value must match the specified pattern.

Note

TODO: We use Regexp.SimpleRegexp to handle schema->pattern, but that covers only some part of the possible regular expressions.