From 68ffa5258cf82a406cff97847c8f8fe2e7f0a2e2 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 3 Dec 2025 12:04:30 +0530 Subject: [PATCH] fix: roles enum --- app/config/specs/open-api3-1.8.x-client.json | 20 +++++++++---------- app/config/specs/open-api3-1.8.x-console.json | 20 +++++++++---------- app/config/specs/open-api3-1.8.x-server.json | 20 +++++++++---------- app/config/specs/open-api3-latest-client.json | 20 +++++++++---------- .../specs/open-api3-latest-console.json | 20 +++++++++---------- app/config/specs/open-api3-latest-server.json | 20 +++++++++---------- app/config/specs/swagger2-1.8.x-client.json | 20 +++++++++---------- app/config/specs/swagger2-1.8.x-console.json | 20 +++++++++---------- app/config/specs/swagger2-1.8.x-server.json | 20 +++++++++---------- app/config/specs/swagger2-latest-client.json | 20 +++++++++---------- app/config/specs/swagger2-latest-console.json | 20 +++++++++---------- app/config/specs/swagger2-latest-server.json | 20 +++++++++---------- .../SDK/Specification/Format/OpenAPI3.php | 8 ++++---- .../SDK/Specification/Format/Swagger2.php | 8 ++++---- 14 files changed, 128 insertions(+), 128 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-client.json b/app/config/specs/open-api3-1.8.x-client.json index 7c6f4749dd..5d645ac86e 100644 --- a/app/config/specs/open-api3-1.8.x-client.json +++ b/app/config/specs/open-api3-1.8.x-client.json @@ -10840,11 +10840,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -11025,11 +11025,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 1e20edb1cf..c1df21555c 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -42880,11 +42880,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -43065,11 +43065,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 2cc71b5e0f..34087a9d74 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -32311,11 +32311,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -32500,11 +32500,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 7c6f4749dd..5d645ac86e 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -10840,11 +10840,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -11025,11 +11025,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 1e20edb1cf..c1df21555c 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -42880,11 +42880,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -43065,11 +43065,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 2cc71b5e0f..34087a9d74 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -32311,11 +32311,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -32500,11 +32500,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/swagger2-1.8.x-client.json b/app/config/specs/swagger2-1.8.x-client.json index 0d3be23667..aaa0ca3eba 100644 --- a/app/config/specs/swagger2-1.8.x-client.json +++ b/app/config/specs/swagger2-1.8.x-client.json @@ -10814,11 +10814,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -10992,11 +10992,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index bdb559f51b..8f61ff8f29 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -42726,11 +42726,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -42904,11 +42904,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index a4a97b8723..b06a46a10e 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -32245,11 +32245,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -32427,11 +32427,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 0d3be23667..aaa0ca3eba 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -10814,11 +10814,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -10992,11 +10992,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index bdb559f51b..8f61ff8f29 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -42726,11 +42726,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -42904,11 +42904,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index a4a97b8723..b06a46a10e 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -32245,11 +32245,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } @@ -32427,11 +32427,11 @@ "x-example": null, "items": { "type": "string", - "enum": { - "2": "admin", - "3": "developer", - "4": "owner" - }, + "enum": [ + "admin", + "developer", + "owner" + ], "x-enum-name": null, "x-enum-keys": [] } diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 8e6dc68dfa..bfa33e19f3 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -626,7 +626,7 @@ class OpenAPI3 extends Format } } if ($allowed && $validator->getType() === 'string') { - $node['schema']['items']['enum'] = $validator->getList(); + $node['schema']['items']['enum'] = \array_values($validator->getList()); $node['schema']['items']['x-enum-name'] = $this->getRequestEnumName($sdk->getNamespace() ?? '', $methodName, $name); $node['schema']['items']['x-enum-keys'] = $this->getRequestEnumKeys($sdk->getNamespace() ?? '', $methodName, $name); } @@ -651,7 +651,7 @@ class OpenAPI3 extends Format } } if ($allowed && $validator->getType() === 'string') { - $node['schema']['enum'] = $validator->getList(); + $node['schema']['enum'] = \array_values($validator->getList()); $node['schema']['x-enum-name'] = $this->getRequestEnumName($sdk->getNamespace() ?? '', $methodName, $name); $node['schema']['x-enum-keys'] = $this->getRequestEnumKeys($sdk->getNamespace() ?? '', $methodName, $name); } @@ -905,13 +905,13 @@ class OpenAPI3 extends Format } if ($rule['type'] === 'enum' && !empty($rule['enum'])) { if ($rule['array']) { - $output['components']['schemas'][$model->getType()]['properties'][$name]['items']['enum'] = $rule['enum']; + $output['components']['schemas'][$model->getType()]['properties'][$name]['items']['enum'] = \array_values($rule['enum']); $enumName = $this->getResponseEnumName($model->getType(), $name); if ($enumName) { $output['components']['schemas'][$model->getType()]['properties'][$name]['items']['x-enum-name'] = $enumName; } } else { - $output['components']['schemas'][$model->getType()]['properties'][$name]['enum'] = $rule['enum']; + $output['components']['schemas'][$model->getType()]['properties'][$name]['enum'] = \array_values($rule['enum']); $enumName = $this->getResponseEnumName($model->getType(), $name); if ($enumName) { $output['components']['schemas'][$model->getType()]['properties'][$name]['x-enum-name'] = $enumName; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 2e86796bed..eddde30f87 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -611,7 +611,7 @@ class Swagger2 extends Format } } if ($allowed && $validator->getType() === 'string') { - $node['items']['enum'] = $validator->getList(); + $node['items']['enum'] = \array_values($validator->getList()); $node['items']['x-enum-name'] = $this->getRequestEnumName($namespace, $methodName, $name); $node['items']['x-enum-keys'] = $this->getRequestEnumKeys($namespace, $methodName, $name); } @@ -631,7 +631,7 @@ class Swagger2 extends Format } } if ($allowed && $validator->getType() === 'string') { - $node['enum'] = $validator->getList(); + $node['enum'] = \array_values($validator->getList()); $node['x-enum-name'] = $this->getRequestEnumName($namespace, $methodName, $name); $node['x-enum-keys'] = $this->getRequestEnumKeys($namespace, $methodName, $name); } @@ -901,13 +901,13 @@ class Swagger2 extends Format } if ($rule['type'] === 'enum' && !empty($rule['enum'])) { if ($rule['array']) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['enum'] = $rule['enum']; + $output['definitions'][$model->getType()]['properties'][$name]['items']['enum'] = \array_values($rule['enum']); $enumName = $this->getResponseEnumName($model->getType(), $name); if ($enumName) { $output['definitions'][$model->getType()]['properties'][$name]['items']['x-enum-name'] = $enumName; } } else { - $output['definitions'][$model->getType()]['properties'][$name]['enum'] = $rule['enum']; + $output['definitions'][$model->getType()]['properties'][$name]['enum'] = \array_values($rule['enum']); $enumName = $this->getResponseEnumName($model->getType(), $name); if ($enumName) { $output['definitions'][$model->getType()]['properties'][$name]['x-enum-name'] = $enumName;