#[Param]

Attribute on parameters.

use Saij\WpAppFramework\Rest\Param;

Additional JSON schema keywords for a request argument of a #[RestRoute] method.

WordPress validates the keywords: minimum/maximum apply to int and float parameters, minLength/maxLength/pattern/format to string parameters.

Arguments

#[Param(?string $description = null, int|float|null $minimum = null, int|float|null $maximum = null, ?int $minLength = null, ?int $maxLength = null, ?string $pattern = null, ?Format $format = null)]
ParameterTypeDefaultDescription
descriptionstring|nullnullDescribes the argument in the schema, e.g. in the answer to an OPTIONS request; any parameter type.
minimumint|float|nullnullThe lowest allowed value, included; int and float parameters.
maximumint|float|nullnullThe highest allowed value, included; int and float parameters.
minLengthint|nullnullThe minimum number of characters; string parameters.
maxLengthint|nullnullThe maximum number of characters; string parameters.
patternstring|nullnullA regular expression without delimiters that the value must match somewhere (anchor it with ^ and $ to match the whole value); string parameters. The build reports an invalid expression.
formatFormat|nullnullA format WordPress validates or sanitizes the value with; string parameters.