mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: remove content-type header from get request specs
This commit is contained in:
@@ -137,10 +137,13 @@ class OpenAPI3 extends Format
|
||||
$sdk = $mainSdk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Appwrite\SDK\Method $sdk
|
||||
*/
|
||||
$consumes = [$sdk->getRequestType()];
|
||||
$consumes = [];
|
||||
if (strtoupper($route->getMethod()) !== 'GET') {
|
||||
/**
|
||||
* @var \Appwrite\SDK\Method $sdk
|
||||
*/
|
||||
$consumes = [$sdk->getRequestType()];
|
||||
}
|
||||
|
||||
$method = $sdk->getMethodName() ?? \uniqid();
|
||||
|
||||
@@ -318,16 +321,18 @@ class OpenAPI3 extends Format
|
||||
}
|
||||
|
||||
$body = [
|
||||
'content' => [
|
||||
$consumes[0] => [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'properties' => [],
|
||||
],
|
||||
],
|
||||
],
|
||||
'content' => [],
|
||||
];
|
||||
|
||||
if (!empty($consumes)) {
|
||||
$body['content'][$consumes[0]] = [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'properties' => [],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$bodyRequired = [];
|
||||
|
||||
foreach ($route->getParams() as $name => $param) { // Set params
|
||||
@@ -526,48 +531,50 @@ class OpenAPI3 extends Format
|
||||
$bodyRequired[] = $name;
|
||||
}
|
||||
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name] = [
|
||||
'type' => $node['schema']['type'],
|
||||
'description' => $node['description'],
|
||||
'x-example' => $node['schema']['x-example'] ?? null
|
||||
];
|
||||
if (!empty($consumes)) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name] = [
|
||||
'type' => $node['schema']['type'],
|
||||
'description' => $node['description'],
|
||||
'x-example' => $node['schema']['x-example'] ?? null
|
||||
];
|
||||
|
||||
if (isset($node['schema']['enum'])) {
|
||||
/// If the enum flag is Set, add the enum values to the body
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['enum'] = $node['schema']['enum'];
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-name'] = $node['schema']['x-enum-name'] ?? null;
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-keys'] = $node['schema']['x-enum-keys'] ?? null;
|
||||
}
|
||||
if (isset($node['schema']['enum'])) {
|
||||
/// If the enum flag is Set, add the enum values to the body
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['enum'] = $node['schema']['enum'];
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-name'] = $node['schema']['x-enum-name'] ?? null;
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-keys'] = $node['schema']['x-enum-keys'] ?? null;
|
||||
}
|
||||
|
||||
if ($node['schema']['x-upload-id'] ?? false) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-upload-id'] = $node['schema']['x-upload-id'];
|
||||
}
|
||||
if ($node['schema']['x-upload-id'] ?? false) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-upload-id'] = $node['schema']['x-upload-id'];
|
||||
}
|
||||
|
||||
if (isset($node['default'])) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['default'] = $node['default'];
|
||||
}
|
||||
if (isset($node['default'])) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['default'] = $node['default'];
|
||||
}
|
||||
|
||||
if (\array_key_exists('items', $node['schema'])) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['items'] = $node['schema']['items'];
|
||||
}
|
||||
if (\array_key_exists('items', $node['schema'])) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['items'] = $node['schema']['items'];
|
||||
}
|
||||
|
||||
if ($node['x-global'] ?? false) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-global'] = true;
|
||||
}
|
||||
if ($node['x-global'] ?? false) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-global'] = true;
|
||||
}
|
||||
|
||||
if ($isNullable) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-nullable'] = true;
|
||||
if ($isNullable) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-nullable'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$url = \str_replace(':' . $name, '{' . $name . '}', $url);
|
||||
}
|
||||
|
||||
if (!empty($bodyRequired)) {
|
||||
if (!empty($bodyRequired) && !empty($consumes)) {
|
||||
$body['content'][$consumes[0]]['schema']['required'] = $bodyRequired;
|
||||
}
|
||||
|
||||
if (!empty($body['content'][$consumes[0]]['schema']['properties'])) {
|
||||
if (!empty($consumes) && !empty($body['content'][$consumes[0]]['schema']['properties'])) {
|
||||
$temp['requestBody'] = $body;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,10 @@ class Swagger2 extends Format
|
||||
$sdk = $mainSdk;
|
||||
}
|
||||
|
||||
$consumes = [$sdk->getRequestType()];
|
||||
$consumes = [];
|
||||
if (strtoupper($route->getMethod()) !== 'GET') {
|
||||
$consumes = [$sdk->getRequestType()];
|
||||
}
|
||||
|
||||
$method = $sdk->getMethodName() ?? \uniqid();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user