1
0
Fork 0
mirror of synced 2024-05-20 12:42:39 +12:00

fix spec type mismatch

This commit is contained in:
Damodar Lohani 2021-05-21 14:29:51 +05:45
parent fd509ad282
commit 09874e9c5d
2 changed files with 7 additions and 7 deletions

View file

@ -256,7 +256,7 @@ class OpenAPI3 extends Format
case 'Utopia\Validator\Mock':
case 'Utopia\Validator\Assoc':
$param['default'] = (empty($param['default'])) ? new stdClass() : $param['default'];
$node['schema']['type'] = $validator->getType();
$node['schema']['type'] = 'object';
$node['schema']['x-example'] = '{}';
//$node['schema']['format'] = 'json';
break;
@ -266,18 +266,18 @@ class OpenAPI3 extends Format
$node['schema']['format'] = 'binary';
break;
case 'Utopia\Validator\ArrayList':
$node['schema']['type'] = $validator->getType();
$node['schema']['type'] = 'array';
$node['schema']['items'] = [
'type' => 'string',
];
break;
case 'Appwrite\Auth\Validator\Password':
$node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'format';
$node['schema']['format'] = 'password';
$node['schema']['x-example'] = 'password';
break;
case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */
$node['type'] = $validator->getType() == Validator::TYPE_FLOAT ? 'number': $validator->getType();
$node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number': $validator->getType();
$node['schema']['format'] = $validator->getType() == Validator::TYPE_INTEGER ? 'int32' : 'float';
$node['schema']['x-example'] = $validator->getMin();
break;

View file

@ -252,7 +252,7 @@ class Swagger2 extends Format
case 'Utopia\Validator\JSON':
case 'Utopia\Validator\Mock':
case 'Utopia\Validator\Assoc':
$node['type'] = $validator->getType();
$node['type'] = 'object';
$param['default'] = (empty($param['default'])) ? new stdClass() : $param['default'];
$node['x-example'] = '{}';
//$node['format'] = 'json';
@ -262,7 +262,7 @@ class Swagger2 extends Format
$node['type'] = $validator->getType();
break;
case 'Utopia\Validator\ArrayList':
$node['type'] = $validator->getType();
$node['type'] = 'array';
$node['collectionFormat'] = 'multi';
$node['items'] = [
'type' => 'string',
@ -274,7 +274,7 @@ class Swagger2 extends Format
$node['x-example'] = 'password';
break;
case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */
$node['type'] = $validator->getType() == Validator::TYPE_FLOAT ? 'number': $validator->getType();
$node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number': $validator->getType();
$node['format'] = $validator->getType() == Validator::TYPE_INTEGER ? 'int32' : 'float';
$node['x-example'] = $validator->getMin();
break;