Merge pull request #8543 from appwrite/fix-anyof-validator-specs

Fix: anyof validator specs
This commit is contained in:
Christy Jacob 2024-08-16 13:01:05 +04:00 committed by GitHub
commit a114977100
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1642,7 +1642,7 @@ App::post('/v1/functions/:functionId/executions')
->param('async', false, new Boolean(), 'Execute code in the background. Default value is false.', true)
->param('path', '/', new Text(2048), 'HTTP path of execution. Path can include query params. Default value is /', true)
->param('method', 'POST', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], true), 'HTTP method of execution. Default value is GET.', true)
->param('headers', [], new AnyOf([new Text(65535), new Assoc()], AnyOf::TYPE_MIXED), 'HTTP headers of execution. Defaults to empty.', true)
->param('headers', [], new AnyOf([new Assoc(), new Text(65535)], AnyOf::TYPE_MIXED), 'HTTP headers of execution. Defaults to empty.', true)
->param('scheduledAt', null, new DatetimeValidator(requireDateInFuture: true), 'Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.', true)
->inject('response')
->inject('request')

12
composer.lock generated
View file

@ -1923,16 +1923,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.33.7",
"version": "0.33.8",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/http.git",
"reference": "78d293d99a262bd63ece750bbf989c7e0643b825"
"reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/http/zipball/78d293d99a262bd63ece750bbf989c7e0643b825",
"reference": "78d293d99a262bd63ece750bbf989c7e0643b825",
"url": "https://api.github.com/repos/utopia-php/http/zipball/a7f577540a25cb90896fef2b64767bf8d700f3c5",
"reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5",
"shasum": ""
},
"require": {
@ -1962,9 +1962,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/http/issues",
"source": "https://github.com/utopia-php/http/tree/0.33.7"
"source": "https://github.com/utopia-php/http/tree/0.33.8"
},
"time": "2024-08-01T14:01:04+00:00"
"time": "2024-08-15T14:10:09+00:00"
},
{
"name": "utopia-php/image",

View file

@ -286,7 +286,13 @@ class Swagger2 extends Format
$validator = $validator->getValidator();
}
switch ((!empty($validator)) ? \get_class($validator) : '') {
$validatorClass = (!empty($validator)) ? \get_class($validator) : '';
if($validatorClass === 'Utopia\Validator\AnyOf') {
$validator = $param['validator']->getValidators()[0];
$validatorClass = \get_class($validator);
}
switch ($validatorClass) {
case 'Utopia\Validator\Text':
case 'Utopia\Database\Validator\UID':
$node['type'] = $validator->getType();