pr followups

This commit is contained in:
ArnabChatterjee20k
2025-09-05 18:35:09 +05:30
parent c2f61c1998
commit 55b68e45e4
15 changed files with 16 additions and 85 deletions
@@ -9,7 +9,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Document;
@@ -9,7 +9,7 @@ use Appwrite\SDK\ContentType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -9,7 +9,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Document;
@@ -9,7 +9,7 @@ use Appwrite\SDK\ContentType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -9,7 +9,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Document;
@@ -9,7 +9,7 @@ use Appwrite\SDK\ContentType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -6,7 +6,7 @@ use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Li
use Appwrite\SDK\AuthType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -7,7 +7,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -6,7 +6,7 @@ use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Po
use Appwrite\SDK\AuthType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -7,7 +7,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -6,7 +6,7 @@ use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Po
use Appwrite\SDK\AuthType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -7,7 +7,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Spatial;
use Utopia\Database\Validator\Spatial;
use Appwrite\Utopia\Response as UtopiaResponse;
use Utopia\Database\Database;
use Utopia\Database\Validator\Key;
@@ -447,11 +447,12 @@ class OpenAPI3 extends Format
'type' => $validator->getValidator()->getType(),
];
break;
case 'Appwrite\Utopia\Database\Validator\Spatial':
case 'Utopia\Database\Validator\Spatial':
$node['schema']['type'] = 'array';
$node['schema']['items'] = [
'type' => '{}',
];
$node['schema']['x-example'] = [[1,2], [3, 4]];
break;
case 'Appwrite\Utopia\Database\Validator\Queries\Columns':
case 'Appwrite\Utopia\Database\Validator\Queries\Attributes':
@@ -672,10 +673,6 @@ class OpenAPI3 extends Format
$type = 'string';
break;
case 'array':
$type = 'array';
break;
case 'json':
$type = 'object';
$output['components']['schemas'][$model->getType()]['properties'][$name]['additionalProperties'] = true;
@@ -462,11 +462,12 @@ class Swagger2 extends Format
'type' => $validator->getValidator()->getType(),
];
break;
case 'Appwrite\Utopia\Database\Validator\Spatial':
case 'Utopia\Database\Validator\Spatial':
$node['type'] = 'array';
$node['items'] = [
'type' => '{}',
];
$node['x-example'] = [[1,2], [3, 4]];
break;
case 'Utopia\Validator\JSON':
case 'Utopia\Validator\Mock':
@@ -680,10 +681,6 @@ class Swagger2 extends Format
$type = 'string';
break;
case 'array':
$type = 'array';
break;
case 'json':
$type = 'object';
break;
@@ -1,63 +0,0 @@
<?php
namespace Appwrite\Utopia\Database\Validator;
use Utopia\Database\Validator\Spatial as SpatialValidator;
use Utopia\Validator;
class Spatial extends Validator
{
private string $spatialAttributeType;
public function getDescription(): string
{
return 'Value must be a valid spatial type JSON string';
}
/**
* @param string $spatialAttributeType
*/
public function __construct(string $spatialAttributeType)
{
$this->spatialAttributeType = $spatialAttributeType;
}
/**
* Is array
*
* Function will return true if object is array.
*
* @return bool
*/
public function isArray(): bool
{
return true;
}
/**
* Get Type
*
* Returns validator type
*
* @return string
*/
public function getType(): string
{
return self::TYPE_ARRAY;
}
/**
* Is valid.
*
* Returns true if valid or false if not.
*
* @param $value
*
* @return bool
*/
public function isValid($value): bool
{
$validator = new SpatialValidator($this->spatialAttributeType);
return $validator->isValid($value);
}
}