Fix specs of AnyOf validator

This commit is contained in:
Matej Bačo
2024-08-15 12:12:15 +00:00
parent e8f40342b1
commit 92c423f744
8 changed files with 31 additions and 16 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ _APP_CONSOLE_WHITELIST_EMAILS=
_APP_CONSOLE_SESSION_ALERTS=enabled
_APP_CONSOLE_WHITELIST_IPS=
_APP_CONSOLE_COUNTRIES_DENYLIST=AQ
_APP_CONSOLE_HOSTNAMES=localhost,appwrite.io,*.appwrite.io
_APP_CONSOLE_HOSTNAMES=*
_APP_SYSTEM_EMAIL_NAME=Appwrite
_APP_SYSTEM_EMAIL_ADDRESS=noreply@appwrite.io
_APP_SYSTEM_TEAM_EMAIL=team@appwrite.io
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
+1 -1
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')
+1 -1
View File
@@ -53,7 +53,7 @@
"utopia-php/database": "0.50.*",
"utopia-php/domains": "0.5.*",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
"utopia-php/framework": "dev-feat-multiple-validator-export as 0.33.99",
"utopia-php/fetch": "0.2.*",
"utopia-php/image": "0.6.*",
"utopia-php/locale": "0.4.*",
Generated
+18 -9
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "340aae0879435fc71eac688d47033eb4",
"content-hash": "219bceaa390a41c5c9a0d670a0dffbc0",
"packages": [
{
"name": "adhocore/jwt",
@@ -1923,16 +1923,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.33.7",
"version": "dev-feat-multiple-validator-export",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/http.git",
"reference": "78d293d99a262bd63ece750bbf989c7e0643b825"
"reference": "3cf34e0bf000054b3c2f817c0ebde557a59b9916"
},
"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/3cf34e0bf000054b3c2f817c0ebde557a59b9916",
"reference": "3cf34e0bf000054b3c2f817c0ebde557a59b9916",
"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/feat-multiple-validator-export"
},
"time": "2024-08-01T14:01:04+00:00"
"time": "2024-08-15T12:03:07+00:00"
},
{
"name": "utopia-php/image",
@@ -5592,9 +5592,18 @@
"time": "2023-11-21T18:54:41+00:00"
}
],
"aliases": [],
"aliases": [
{
"package": "utopia-php/framework",
"version": "dev-feat-multiple-validator-export",
"alias": "0.33.99",
"alias_normalized": "0.33.99.0"
}
],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"utopia-php/framework": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@@ -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();