From c9691be34a55c63f19361b57a5e3a4e3c327adab Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 8 Aug 2025 12:53:58 +0530 Subject: [PATCH 1/3] chore: add readonly param to sequence, databaseId and collectionId --- app/config/specs/open-api3-latest-client.json | 9 ++++--- .../specs/open-api3-latest-console.json | 16 ++++++++++--- app/config/specs/open-api3-latest-server.json | 9 ++++--- app/config/specs/swagger2-latest-client.json | 9 ++++--- app/config/specs/swagger2-latest-console.json | 16 ++++++++++--- app/config/specs/swagger2-latest-server.json | 9 ++++--- .../SDK/Specification/Format/OpenAPI3.php | 7 ++++++ .../SDK/Specification/Format/Swagger2.php | 11 +++++++++ src/Appwrite/Utopia/Response/Model.php | 24 ++++++++++++++++++- .../Utopia/Response/Model/Document.php | 3 +++ 10 files changed, 94 insertions(+), 19 deletions(-) diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 6813c71f74..c8c8bced7a 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -8479,17 +8479,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 358b282600..2d4e63cd50 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -37978,17 +37978,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", @@ -44635,6 +44638,11 @@ "description": "AAAA target for your Appwrite custom domains.", "x-example": "::1" }, + "_APP_DOMAIN_TARGET_CAA": { + "type": "string", + "description": "CAA target for your Appwrite custom domains.", + "x-example": "digicert.com" + }, "_APP_STORAGE_LIMIT": { "type": "integer", "description": "Maximum file size allowed for file upload in bytes.", @@ -44692,6 +44700,7 @@ "_APP_DOMAIN_TARGET_CNAME", "_APP_DOMAIN_TARGET_A", "_APP_DOMAIN_TARGET_AAAA", + "_APP_DOMAIN_TARGET_CAA", "_APP_STORAGE_LIMIT", "_APP_COMPUTE_SIZE_LIMIT", "_APP_USAGE_STATS", @@ -44707,6 +44716,7 @@ "_APP_DOMAIN_TARGET_CNAME": "appwrite.io", "_APP_DOMAIN_TARGET_A": "127.0.0.1", "_APP_DOMAIN_TARGET_AAAA": "::1", + "_APP_DOMAIN_TARGET_CAA": "digicert.com", "_APP_STORAGE_LIMIT": "30000000", "_APP_COMPUTE_SIZE_LIMIT": "30000000", "_APP_USAGE_STATS": "enabled", diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 35a1066924..5df94385d2 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -27864,17 +27864,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 07a12f0dbb..d9fe0fc2ad 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -8516,17 +8516,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index 32afa9e180..aa50976993 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -38139,17 +38139,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", @@ -44900,6 +44903,11 @@ "description": "AAAA target for your Appwrite custom domains.", "x-example": "::1" }, + "_APP_DOMAIN_TARGET_CAA": { + "type": "string", + "description": "CAA target for your Appwrite custom domains.", + "x-example": "digicert.com" + }, "_APP_STORAGE_LIMIT": { "type": "integer", "description": "Maximum file size allowed for file upload in bytes.", @@ -44957,6 +44965,7 @@ "_APP_DOMAIN_TARGET_CNAME", "_APP_DOMAIN_TARGET_A", "_APP_DOMAIN_TARGET_AAAA", + "_APP_DOMAIN_TARGET_CAA", "_APP_STORAGE_LIMIT", "_APP_COMPUTE_SIZE_LIMIT", "_APP_USAGE_STATS", @@ -44972,6 +44981,7 @@ "_APP_DOMAIN_TARGET_CNAME": "appwrite.io", "_APP_DOMAIN_TARGET_A": "127.0.0.1", "_APP_DOMAIN_TARGET_AAAA": "::1", + "_APP_DOMAIN_TARGET_CAA": "digicert.com", "_APP_STORAGE_LIMIT": "30000000", "_APP_COMPUTE_SIZE_LIMIT": "30000000", "_APP_USAGE_STATS": "enabled", diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 391adc2dfc..9143acf928 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -28092,17 +28092,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index c4a39b707b..c5dfd35bcc 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -686,6 +686,7 @@ class OpenAPI3 extends Format break; } + $readOnly = $rule['readonly'] ?? false; if ($rule['array']) { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ 'type' => 'array', @@ -699,6 +700,9 @@ class OpenAPI3 extends Format if ($format) { $output['components']['schemas'][$model->getType()]['properties'][$name]['items']['format'] = $format; } + if ($readOnly) { + $output['components']['schemas'][$model->getType()]['properties'][$name]['readonly'] = true; + } } else { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ 'type' => $type, @@ -709,6 +713,9 @@ class OpenAPI3 extends Format if ($format) { $output['components']['schemas'][$model->getType()]['properties'][$name]['format'] = $format; } + if ($readOnly) { + $output['components']['schemas'][$model->getType()]['properties'][$name]['readonly'] = true; + } } if ($items) { $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 45fdc63bc8..f182ba1e51 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -692,6 +692,7 @@ class Swagger2 extends Format break; } + $readOnly = $rule['readonly'] ?? false; if ($rule['type'] == 'json') { $output['definitions'][$model->getType()]['properties'][$name] = [ 'type' => $type, @@ -699,6 +700,10 @@ class Swagger2 extends Format 'description' => $rule['description'] ?? '', 'x-example' => $rule['example'] ?? null, ]; + + if ($readOnly) { + $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; + } continue; } @@ -715,6 +720,9 @@ class Swagger2 extends Format if ($format) { $output['definitions'][$model->getType()]['properties'][$name]['items']['format'] = $format; } + if ($readOnly) { + $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; + } } else { $output['definitions'][$model->getType()]['properties'][$name] = [ 'type' => $type, @@ -725,6 +733,9 @@ class Swagger2 extends Format if ($format) { $output['definitions'][$model->getType()]['properties'][$name]['format'] = $format; } + if ($readOnly) { + $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; + } } if ($items) { $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items; diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 32de9fa035..43849e582d 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -91,7 +91,8 @@ abstract class Model 'array' => false, 'description' => '', 'example' => '', - 'sensitive' => false + 'sensitive' => false, + 'readonly' => false ], $options); return $this; @@ -129,6 +130,27 @@ abstract class Model return $list; } + /** + * Get Readonly Fields + * + * Returns list of field names that are marked as readonly + * and should not be allowed in create/update payloads + * + * @return array + */ + public function getReadonlyFields(): array + { + $list = []; + + foreach ($this->rules as $key => $rule) { + if ($rule['readonly'] ?? false) { + $list[] = $key; + } + } + + return $list; + } + /** * Is None * diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index dc9faf6a8e..90691db78e 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -41,18 +41,21 @@ class Document extends Any 'description' => 'Document automatically incrementing ID.', 'default' => 0, 'example' => 1, + 'readonly' => true, ]) ->addRule('$collectionId', [ 'type' => self::TYPE_STRING, 'description' => 'Collection ID.', 'default' => '', 'example' => '5e5ea5c15117e', + 'readonly' => true, ]) ->addRule('$databaseId', [ 'type' => self::TYPE_STRING, 'description' => 'Database ID.', 'default' => '', 'example' => '5e5ea5c15117e', + 'readonly' => true, ]) ->addRule('$createdAt', [ 'type' => self::TYPE_DATETIME, From b464a3d7a25ad248bacb4ef6181959921949cb92 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 8 Aug 2025 13:39:25 +0530 Subject: [PATCH 2/3] fix: lint --- app/config/specs/open-api3-1.7.x-client.json | 9 ++++++--- app/config/specs/open-api3-1.7.x-console.json | 16 +++++++++++++--- app/config/specs/open-api3-1.7.x-server.json | 9 ++++++--- app/config/specs/swagger2-1.7.x-client.json | 9 ++++++--- app/config/specs/swagger2-1.7.x-console.json | 16 +++++++++++++--- app/config/specs/swagger2-1.7.x-server.json | 9 ++++++--- .../SDK/Specification/Format/OpenAPI3.php | 6 +++--- .../SDK/Specification/Format/Swagger2.php | 8 ++++---- src/Appwrite/Utopia/Response/Model.php | 2 +- 9 files changed, 58 insertions(+), 26 deletions(-) diff --git a/app/config/specs/open-api3-1.7.x-client.json b/app/config/specs/open-api3-1.7.x-client.json index 6813c71f74..c8c8bced7a 100644 --- a/app/config/specs/open-api3-1.7.x-client.json +++ b/app/config/specs/open-api3-1.7.x-client.json @@ -8479,17 +8479,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-1.7.x-console.json b/app/config/specs/open-api3-1.7.x-console.json index 358b282600..2d4e63cd50 100644 --- a/app/config/specs/open-api3-1.7.x-console.json +++ b/app/config/specs/open-api3-1.7.x-console.json @@ -37978,17 +37978,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", @@ -44635,6 +44638,11 @@ "description": "AAAA target for your Appwrite custom domains.", "x-example": "::1" }, + "_APP_DOMAIN_TARGET_CAA": { + "type": "string", + "description": "CAA target for your Appwrite custom domains.", + "x-example": "digicert.com" + }, "_APP_STORAGE_LIMIT": { "type": "integer", "description": "Maximum file size allowed for file upload in bytes.", @@ -44692,6 +44700,7 @@ "_APP_DOMAIN_TARGET_CNAME", "_APP_DOMAIN_TARGET_A", "_APP_DOMAIN_TARGET_AAAA", + "_APP_DOMAIN_TARGET_CAA", "_APP_STORAGE_LIMIT", "_APP_COMPUTE_SIZE_LIMIT", "_APP_USAGE_STATS", @@ -44707,6 +44716,7 @@ "_APP_DOMAIN_TARGET_CNAME": "appwrite.io", "_APP_DOMAIN_TARGET_A": "127.0.0.1", "_APP_DOMAIN_TARGET_AAAA": "::1", + "_APP_DOMAIN_TARGET_CAA": "digicert.com", "_APP_STORAGE_LIMIT": "30000000", "_APP_COMPUTE_SIZE_LIMIT": "30000000", "_APP_USAGE_STATS": "enabled", diff --git a/app/config/specs/open-api3-1.7.x-server.json b/app/config/specs/open-api3-1.7.x-server.json index 35a1066924..5df94385d2 100644 --- a/app/config/specs/open-api3-1.7.x-server.json +++ b/app/config/specs/open-api3-1.7.x-server.json @@ -27864,17 +27864,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-1.7.x-client.json b/app/config/specs/swagger2-1.7.x-client.json index 07a12f0dbb..d9fe0fc2ad 100644 --- a/app/config/specs/swagger2-1.7.x-client.json +++ b/app/config/specs/swagger2-1.7.x-client.json @@ -8516,17 +8516,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-1.7.x-console.json b/app/config/specs/swagger2-1.7.x-console.json index 32afa9e180..aa50976993 100644 --- a/app/config/specs/swagger2-1.7.x-console.json +++ b/app/config/specs/swagger2-1.7.x-console.json @@ -38139,17 +38139,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", @@ -44900,6 +44903,11 @@ "description": "AAAA target for your Appwrite custom domains.", "x-example": "::1" }, + "_APP_DOMAIN_TARGET_CAA": { + "type": "string", + "description": "CAA target for your Appwrite custom domains.", + "x-example": "digicert.com" + }, "_APP_STORAGE_LIMIT": { "type": "integer", "description": "Maximum file size allowed for file upload in bytes.", @@ -44957,6 +44965,7 @@ "_APP_DOMAIN_TARGET_CNAME", "_APP_DOMAIN_TARGET_A", "_APP_DOMAIN_TARGET_AAAA", + "_APP_DOMAIN_TARGET_CAA", "_APP_STORAGE_LIMIT", "_APP_COMPUTE_SIZE_LIMIT", "_APP_USAGE_STATS", @@ -44972,6 +44981,7 @@ "_APP_DOMAIN_TARGET_CNAME": "appwrite.io", "_APP_DOMAIN_TARGET_A": "127.0.0.1", "_APP_DOMAIN_TARGET_AAAA": "::1", + "_APP_DOMAIN_TARGET_CAA": "digicert.com", "_APP_STORAGE_LIMIT": "30000000", "_APP_COMPUTE_SIZE_LIMIT": "30000000", "_APP_USAGE_STATS": "enabled", diff --git a/app/config/specs/swagger2-1.7.x-server.json b/app/config/specs/swagger2-1.7.x-server.json index 391adc2dfc..9143acf928 100644 --- a/app/config/specs/swagger2-1.7.x-server.json +++ b/app/config/specs/swagger2-1.7.x-server.json @@ -28092,17 +28092,20 @@ "type": "integer", "description": "Document automatically incrementing ID.", "x-example": 1, - "format": "int32" + "format": "int32", + "readonly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$databaseId": { "type": "string", "description": "Database ID.", - "x-example": "5e5ea5c15117e" + "x-example": "5e5ea5c15117e", + "readonly": true }, "$createdAt": { "type": "string", diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index c5dfd35bcc..16917d92a7 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -686,7 +686,7 @@ class OpenAPI3 extends Format break; } - $readOnly = $rule['readonly'] ?? false; + $readonly = $rule['readonly'] ?? false; if ($rule['array']) { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ 'type' => 'array', @@ -700,7 +700,7 @@ class OpenAPI3 extends Format if ($format) { $output['components']['schemas'][$model->getType()]['properties'][$name]['items']['format'] = $format; } - if ($readOnly) { + if ($readonly) { $output['components']['schemas'][$model->getType()]['properties'][$name]['readonly'] = true; } } else { @@ -713,7 +713,7 @@ class OpenAPI3 extends Format if ($format) { $output['components']['schemas'][$model->getType()]['properties'][$name]['format'] = $format; } - if ($readOnly) { + if ($readonly) { $output['components']['schemas'][$model->getType()]['properties'][$name]['readonly'] = true; } } diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index f182ba1e51..29de27ac97 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -692,7 +692,7 @@ class Swagger2 extends Format break; } - $readOnly = $rule['readonly'] ?? false; + $readonly = $rule['readonly'] ?? false; if ($rule['type'] == 'json') { $output['definitions'][$model->getType()]['properties'][$name] = [ 'type' => $type, @@ -701,7 +701,7 @@ class Swagger2 extends Format 'x-example' => $rule['example'] ?? null, ]; - if ($readOnly) { + if ($readonly) { $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; } continue; @@ -720,7 +720,7 @@ class Swagger2 extends Format if ($format) { $output['definitions'][$model->getType()]['properties'][$name]['items']['format'] = $format; } - if ($readOnly) { + if ($readonly) { $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; } } else { @@ -733,7 +733,7 @@ class Swagger2 extends Format if ($format) { $output['definitions'][$model->getType()]['properties'][$name]['format'] = $format; } - if ($readOnly) { + if ($readonly) { $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; } } diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 43849e582d..7a297f4420 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -132,7 +132,7 @@ abstract class Model /** * Get Readonly Fields - * + * * Returns list of field names that are marked as readonly * and should not be allowed in create/update payloads * From bf6bbfa05890ec00513038d5a86d86dfe33260a0 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 8 Aug 2025 16:40:12 +0530 Subject: [PATCH 3/3] update casing --- app/config/specs/open-api3-1.7.x-client.json | 6 +++--- app/config/specs/open-api3-1.7.x-console.json | 6 +++--- app/config/specs/open-api3-1.7.x-server.json | 6 +++--- app/config/specs/open-api3-latest-client.json | 6 +++--- app/config/specs/open-api3-latest-console.json | 6 +++--- app/config/specs/open-api3-latest-server.json | 6 +++--- app/config/specs/swagger2-1.7.x-client.json | 6 +++--- app/config/specs/swagger2-1.7.x-console.json | 6 +++--- app/config/specs/swagger2-1.7.x-server.json | 6 +++--- app/config/specs/swagger2-latest-client.json | 6 +++--- app/config/specs/swagger2-latest-console.json | 6 +++--- app/config/specs/swagger2-latest-server.json | 6 +++--- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 10 +++++----- src/Appwrite/SDK/Specification/Format/Swagger2.php | 14 +++++++------- src/Appwrite/Utopia/Response/Model.php | 6 +++--- src/Appwrite/Utopia/Response/Model/Document.php | 6 +++--- 16 files changed, 54 insertions(+), 54 deletions(-) diff --git a/app/config/specs/open-api3-1.7.x-client.json b/app/config/specs/open-api3-1.7.x-client.json index c8c8bced7a..dc16932fd4 100644 --- a/app/config/specs/open-api3-1.7.x-client.json +++ b/app/config/specs/open-api3-1.7.x-client.json @@ -8480,19 +8480,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-1.7.x-console.json b/app/config/specs/open-api3-1.7.x-console.json index 2d4e63cd50..0063b8b557 100644 --- a/app/config/specs/open-api3-1.7.x-console.json +++ b/app/config/specs/open-api3-1.7.x-console.json @@ -37979,19 +37979,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-1.7.x-server.json b/app/config/specs/open-api3-1.7.x-server.json index 5df94385d2..b3917036f0 100644 --- a/app/config/specs/open-api3-1.7.x-server.json +++ b/app/config/specs/open-api3-1.7.x-server.json @@ -27865,19 +27865,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index c8c8bced7a..dc16932fd4 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -8480,19 +8480,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 2d4e63cd50..0063b8b557 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -37979,19 +37979,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 5df94385d2..b3917036f0 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -27865,19 +27865,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-1.7.x-client.json b/app/config/specs/swagger2-1.7.x-client.json index d9fe0fc2ad..9941e3db2c 100644 --- a/app/config/specs/swagger2-1.7.x-client.json +++ b/app/config/specs/swagger2-1.7.x-client.json @@ -8517,19 +8517,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-1.7.x-console.json b/app/config/specs/swagger2-1.7.x-console.json index aa50976993..4b458c3a95 100644 --- a/app/config/specs/swagger2-1.7.x-console.json +++ b/app/config/specs/swagger2-1.7.x-console.json @@ -38140,19 +38140,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-1.7.x-server.json b/app/config/specs/swagger2-1.7.x-server.json index 9143acf928..20cf716590 100644 --- a/app/config/specs/swagger2-1.7.x-server.json +++ b/app/config/specs/swagger2-1.7.x-server.json @@ -28093,19 +28093,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index d9fe0fc2ad..9941e3db2c 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -8517,19 +8517,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index aa50976993..4b458c3a95 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -38140,19 +38140,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 9143acf928..20cf716590 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -28093,19 +28093,19 @@ "description": "Document automatically incrementing ID.", "x-example": 1, "format": "int32", - "readonly": true + "readOnly": true }, "$collectionId": { "type": "string", "description": "Collection ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$databaseId": { "type": "string", "description": "Database ID.", "x-example": "5e5ea5c15117e", - "readonly": true + "readOnly": true }, "$createdAt": { "type": "string", diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 16917d92a7..55c71569cb 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -686,7 +686,7 @@ class OpenAPI3 extends Format break; } - $readonly = $rule['readonly'] ?? false; + $readOnly = $rule['readOnly'] ?? false; if ($rule['array']) { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ 'type' => 'array', @@ -700,8 +700,8 @@ class OpenAPI3 extends Format if ($format) { $output['components']['schemas'][$model->getType()]['properties'][$name]['items']['format'] = $format; } - if ($readonly) { - $output['components']['schemas'][$model->getType()]['properties'][$name]['readonly'] = true; + if ($readOnly) { + $output['components']['schemas'][$model->getType()]['properties'][$name]['readOnly'] = true; } } else { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ @@ -713,8 +713,8 @@ class OpenAPI3 extends Format if ($format) { $output['components']['schemas'][$model->getType()]['properties'][$name]['format'] = $format; } - if ($readonly) { - $output['components']['schemas'][$model->getType()]['properties'][$name]['readonly'] = true; + if ($readOnly) { + $output['components']['schemas'][$model->getType()]['properties'][$name]['readOnly'] = true; } } if ($items) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 29de27ac97..654284fa0a 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -692,7 +692,7 @@ class Swagger2 extends Format break; } - $readonly = $rule['readonly'] ?? false; + $readOnly = $rule['readOnly'] ?? false; if ($rule['type'] == 'json') { $output['definitions'][$model->getType()]['properties'][$name] = [ 'type' => $type, @@ -701,8 +701,8 @@ class Swagger2 extends Format 'x-example' => $rule['example'] ?? null, ]; - if ($readonly) { - $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; + if ($readOnly) { + $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; } continue; } @@ -720,8 +720,8 @@ class Swagger2 extends Format if ($format) { $output['definitions'][$model->getType()]['properties'][$name]['items']['format'] = $format; } - if ($readonly) { - $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; + if ($readOnly) { + $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; } } else { $output['definitions'][$model->getType()]['properties'][$name] = [ @@ -733,8 +733,8 @@ class Swagger2 extends Format if ($format) { $output['definitions'][$model->getType()]['properties'][$name]['format'] = $format; } - if ($readonly) { - $output['definitions'][$model->getType()]['properties'][$name]['readonly'] = true; + if ($readOnly) { + $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; } } if ($items) { diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 7a297f4420..962da4834c 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -92,7 +92,7 @@ abstract class Model 'description' => '', 'example' => '', 'sensitive' => false, - 'readonly' => false + 'readOnly' => false ], $options); return $this; @@ -133,7 +133,7 @@ abstract class Model /** * Get Readonly Fields * - * Returns list of field names that are marked as readonly + * Returns list of field names that are marked as readOnly * and should not be allowed in create/update payloads * * @return array @@ -143,7 +143,7 @@ abstract class Model $list = []; foreach ($this->rules as $key => $rule) { - if ($rule['readonly'] ?? false) { + if ($rule['readOnly'] ?? false) { $list[] = $key; } } diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index 90691db78e..5bad504a63 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -41,21 +41,21 @@ class Document extends Any 'description' => 'Document automatically incrementing ID.', 'default' => 0, 'example' => 1, - 'readonly' => true, + 'readOnly' => true, ]) ->addRule('$collectionId', [ 'type' => self::TYPE_STRING, 'description' => 'Collection ID.', 'default' => '', 'example' => '5e5ea5c15117e', - 'readonly' => true, + 'readOnly' => true, ]) ->addRule('$databaseId', [ 'type' => self::TYPE_STRING, 'description' => 'Database ID.', 'default' => '', 'example' => '5e5ea5c15117e', - 'readonly' => true, + 'readOnly' => true, ]) ->addRule('$createdAt', [ 'type' => self::TYPE_DATETIME,