['nullable', 'integer', 'min:1'], 'per_page' => ['nullable', 'integer', 'min:1', 'max:100'], 'search' => ['nullable', 'string', 'sanitize:text', 'max:200'], 'status' => ['nullable', 'integer', 'min:1'], 'stage' => ['nullable', 'integer', 'min:1'], 'topic_type' => ['nullable', 'integer', 'min:1'], // Not `author`: WordPress reads that from the query string as an // author archive and answers its own 404 page before the REST // route runs. 'author_id' => ['nullable', 'integer', 'min:1'], 'visibility' => ['nullable', 'string', new InRule(TopicModerationService::VISIBILITIES)], 'orderby' => ['nullable', 'string', new InRule(TopicModerationService::ORDER_BY)], 'order' => ['nullable', 'string', new InRule(['asc', 'desc'])], 'view' => ['nullable', 'string', 'sanitize:key', 'max:40'], ]; // A taxonomy another plugin files topics under — see TopicTaxonomies. foreach (array_keys(TopicTaxonomies::all()) as $param) { $rules[$param] = ['nullable', 'integer', 'min:1']; } return $rules; } }