mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge branch 'feat-database-indexing' into feat-quest-filters
This commit is contained in:
@@ -483,6 +483,16 @@ class V11 extends Migration
|
||||
$document->setAttribute('$read', ['role:all']);
|
||||
$document->setAttribute('$write', ['role:all']);
|
||||
|
||||
break;
|
||||
case OldDatabase::SYSTEM_COLLECTION_CERTIFICATES:
|
||||
/**
|
||||
* Replace certificateId attribute.
|
||||
*/
|
||||
if ($document->getAttribute('certificateId') !== null) {
|
||||
$document->setAttribute('$id', $document->getAttribute('certificateId'));
|
||||
$document->removeAttribute('certificateId');
|
||||
}
|
||||
|
||||
break;
|
||||
case OldDatabase::SYSTEM_COLLECTION_DOMAINS:
|
||||
$projectId = $this->getProjectIdFromReadPermissions($document);
|
||||
|
||||
@@ -29,7 +29,7 @@ class OpenAPI3 extends Format
|
||||
*/
|
||||
public function parse(): array
|
||||
{
|
||||
/*
|
||||
/**
|
||||
* Specifications (v3.0.0):
|
||||
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md
|
||||
*/
|
||||
@@ -275,6 +275,7 @@ class OpenAPI3 extends Format
|
||||
$node['schema']['x-example'] = false;
|
||||
break;
|
||||
case 'Utopia\Database\Validator\UID':
|
||||
case 'Appwrite\Database\Validator\CustomId':
|
||||
$node['schema']['type'] = $validator->getType();
|
||||
$node['schema']['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']';
|
||||
break;
|
||||
@@ -393,20 +394,18 @@ class OpenAPI3 extends Format
|
||||
|
||||
$output['paths'][$url][\strtolower($route->getMethod())] = $temp;
|
||||
}
|
||||
|
||||
foreach ($this->models as $model) {
|
||||
foreach ($model->getRules() as $rule) {
|
||||
if (!in_array($rule['type'], ['string', 'integer', 'boolean', 'json', 'float'])) {
|
||||
if(\is_array($rule['type'])) {
|
||||
foreach ($rule['type'] as $value) {
|
||||
$usedModels[] = $value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$usedModels[] = $rule['type'];
|
||||
}
|
||||
if (
|
||||
in_array($model->getType(), $usedModels)
|
||||
&& !in_array($rule['type'], ['string', 'integer', 'boolean', 'json', 'float'])
|
||||
) {
|
||||
$usedModels[] = $rule['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->models as $model) {
|
||||
if (!in_array($model->getType(), $usedModels) && $model->getType() !== 'error') {
|
||||
continue;
|
||||
|
||||
@@ -263,6 +263,7 @@ class Swagger2 extends Format
|
||||
$node['x-example'] = false;
|
||||
break;
|
||||
case 'Utopia\Database\Validator\UID':
|
||||
case 'Appwrite\Database\Validator\CustomId':
|
||||
$node['type'] = $validator->getType();
|
||||
$node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']';
|
||||
break;
|
||||
@@ -392,15 +393,11 @@ class Swagger2 extends Format
|
||||
|
||||
foreach ($this->models as $model) {
|
||||
foreach ($model->getRules() as $rule) {
|
||||
if (!in_array($rule['type'], ['string', 'integer', 'boolean', 'json', 'float'])) {
|
||||
if(\is_array($rule['type'])) {
|
||||
foreach ($rule['type'] as $value) {
|
||||
$usedModels[] = $value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$usedModels[] = $rule['type'];
|
||||
}
|
||||
if (
|
||||
in_array($model->getType(), $usedModels)
|
||||
&& !in_array($rule['type'], ['string', 'integer', 'boolean', 'json', 'float'])
|
||||
) {
|
||||
$usedModels[] = $rule['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class Index extends Model
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Index type.',
|
||||
'default' => '',
|
||||
'example' => '',
|
||||
'example' => 'primary',
|
||||
])
|
||||
->addRule('status', [
|
||||
'type' => self::TYPE_STRING,
|
||||
|
||||
Reference in New Issue
Block a user