fix: openapi specification

This commit is contained in:
Torsten Dittmann
2023-03-10 15:36:10 +05:30
parent df9f1ee4c4
commit cb065e4228
11 changed files with 97 additions and 104 deletions
@@ -8,6 +8,7 @@ use Appwrite\Utopia\Response\Model;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Validator;
use Utopia\Validator\Nullable;
class OpenAPI3 extends Format
{
@@ -281,6 +282,11 @@ class OpenAPI3 extends Format
}
}
if ($validator instanceof Nullable) {
$validator = $validator->getValidator();
$node['schema']['x-nullable'] = true;
}
switch ((!empty($validator)) ? \get_class($validator) : '') {
case 'Utopia\Validator\Text':
$node['schema']['type'] = $validator->getType();
@@ -8,6 +8,7 @@ use Appwrite\Utopia\Response\Model;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Validator;
use Utopia\Validator\Nullable;
class Swagger2 extends Format
{
@@ -282,6 +283,11 @@ class Swagger2 extends Format
}
}
if ($validator instanceof Nullable) {
$validator = $validator->getValidator();
$node['schema']['x-nullable'] = true;
}
switch ((!empty($validator)) ? \get_class($validator) : '') {
case 'Utopia\Validator\Text':
$node['type'] = $validator->getType();