Add string length limits
authorGergő Tisza <gtisza@wikimedia.org>
Sun, 12 Nov 2017 09:51:34 +0000 (09:51 +0000)
committerGergő Tisza <gtisza@wikimedia.org>
Tue, 21 Nov 2017 10:24:11 +0000 (10:24 +0000)
Adds two new ApiBase::getAllowedParams() keys:
PARAM_MAX_BYTES and PARAM_MAX_CHARS, to set a length
limit for a (string-like) parameter.

This makes it easy to document and enforce database
field length limits (where relying on the database
would either result in unfriendly error messages or
silent truncation, depending on DB settings) and
also exposes them in structured form so API clients
can verify the length without doing roundtrips.

Change-Id: I2e784972d7e11cad79fdef887bbcde297dbd9ce0


No differences found