mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fix text response schemas in API specs
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Appwrite\SDK\Specification\Format;
|
||||
|
||||
use Appwrite\Platform\Tasks\Specs;
|
||||
use Appwrite\SDK\AuthType;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\MethodType;
|
||||
use Appwrite\SDK\Response;
|
||||
@@ -291,6 +292,21 @@ class OpenAPI3 extends Format
|
||||
}
|
||||
|
||||
if (!(\is_array($model)) && $model->isNone()) {
|
||||
if ($produces === ContentType::TEXT->value && $response->getCode() !== 204) {
|
||||
$temp['responses'][(string)$response->getCode()] = [
|
||||
'description' => 'Text',
|
||||
'content' => [
|
||||
$produces => [
|
||||
'schema' => [
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$temp['responses'][(string)$response->getCode()] = [
|
||||
'description' => in_array($produces, [
|
||||
'image/*',
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Appwrite\SDK\Specification\Format;
|
||||
|
||||
use Appwrite\Platform\Tasks\Specs;
|
||||
use Appwrite\SDK\AuthType;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\MethodType;
|
||||
use Appwrite\SDK\Response;
|
||||
@@ -298,6 +299,17 @@ class Swagger2 extends Format
|
||||
}
|
||||
|
||||
if (!(\is_array($model)) && $model->isNone()) {
|
||||
if ($produces === ContentType::TEXT->value && !\in_array($response->getCode(), [204, 301, 302, 308], true)) {
|
||||
$temp['responses'][(string)$response->getCode()] = [
|
||||
'description' => 'Text',
|
||||
'schema' => [
|
||||
'type' => 'string',
|
||||
],
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$temp['responses'][(string)$response->getCode()] = [
|
||||
'description' => in_array($produces, [
|
||||
'image/*',
|
||||
|
||||
Reference in New Issue
Block a user