Improve customization of queries validator

This commit is contained in:
Matej Bačo 2025-09-05 10:12:07 +02:00
parent bf59f1ba7d
commit ca6cf01773

View file

@ -28,13 +28,13 @@ class XList extends Action
return 'listProjects';
}
// Stored as property intentionally for extensibility
protected Validator $queriesValidator;
protected function getQueriesValidator(): Validator
{
return new Projects();
}
public function __construct()
{
$this->queriesValidator = new Projects();
$this
->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/projects')
@ -57,7 +57,7 @@ class XList extends Action
],
contentType: ContentType::JSON
))
->param('queries', [], $this->queriesValidator, 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Projects::ALLOWED_ATTRIBUTES), true)
->param('queries', [], $this->getQueriesValidator(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Projects::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('dbForPlatform')