-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Spatial type attributes #10443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spatial type attributes #10443
Conversation
|
Warning Rate limit exceeded@ArnabChatterjee20k has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 16 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (9)
📒 Files selected for processing (12)
📝 WalkthroughWalkthroughController/action signatures for spatial attributes (Line, Point, Polygon) now accept ?array $default instead of ?string and no longer JSON-decode defaults at runtime. The Appwrite-scoped Spatial validator class was removed and imports updated to Utopia\Database\Validator\Spatial. Response and Column models introduced TYPE_ARRAY usage, updated example defaults to PHP arrays, and added public $conditions properties. OpenAPI3 and Swagger2 schema generators map the Spatial validator to an array type. GraphQL mapper registers 'array' → json. Tests updated to use native array defaults. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
commit: |
✨ Benchmark results
⚡ Benchmark Comparison
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (10)
src/Appwrite/Utopia/Database/Validator/Spatial.php (1)
12-15: Update description to reflect array input (not JSON string)The validator now expects arrays; description still mentions “JSON string”.
- public function getDescription(): string - { - return 'Value must be a valid spatial type JSON string'; - } + public function getDescription(): string + { + return 'Value must be a valid spatial coordinate array'; + }tests/e2e/Services/Databases/TablesDB/DatabasesBase.php (1)
4106-4106: Fix class name typo: CLient → ClientThis will fatal at runtime; the constant won’t resolve.
Apply this diff:
- $this->client->call(CLient::METHOD_PUT, '/tablesdb/' . $databaseId . '/tables/' . $tableId, [ + $this->client->call(Client::METHOD_PUT, '/tablesdb/' . $databaseId . '/tables/' . $tableId, [tests/e2e/Services/Databases/Legacy/DatabasesBase.php (1)
4178-4186: Typo: CLient::METHOD_PUT will fatally error
CLient(capital “L”) is undefined; this will break the test when enabling document permissions.- $collection = $this->client->call(CLient::METHOD_PUT, '/databases/' . $databaseId . '/collections/' . $collectionId, [ + $collection = $this->client->call(Client::METHOD_PUT, '/databases/' . $databaseId . '/collections/' . $collectionId, [src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
67-67: Update parameter docs: defaults are arrays, not JSON stringsThe description still says “as JSON string”. Adjust to reflect array input and add an example.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for attribute when not provided, as array of coordinates (e.g., [[lon, lat], [lon, lat]]). Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
67-67: Fix param help text to match array inputReplace “as JSON string” with array wording and example.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for attribute when not provided, as array of coordinates (e.g., [lon, lat]). Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
67-67: Correct param description to array format (with rings)Align text with array input and give a minimal example.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as array of linear rings (e.g., [[[lon, lat], [lon, lat], [lon, lat], [lon, lat]]]). Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
67-67: Update param help text to arrayThe description still references JSON strings.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for attribute when not provided, as array of coordinates (e.g., [lon, lat]). Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
67-67: Fix param description: arrays, not JSON stringsAligns docs with the new type and aids SDK generation.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for attribute when not provided, as array of coordinates (e.g., [[lon, lat], [lon, lat]]). Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (2)
67-67: Fix API doc string: defaults are arrays now, not JSON stringsThe parameter description still says “as JSON string,” which contradicts the new
?arraycontract and will mislead SDKs/users.Apply this diff to update the description:
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as array of coordinates. Example: [[[lng, lat], [lng, lat], ...]]. Cannot be set when attribute is required.', true)
63-73: Remove deprecated “as JSON string” phrasing from spatial attribute endpoints
Update the default‐value description in the Create and Update handlers for Point, Line, and Polygon to reflect JSON objects rather than JSON strings:
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (default param on line 67)
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (line 67)
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (line 67)
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (line 67)
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (line 67)
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (line 67)
Replace “as JSON string” with the correct JSON object wording.
🧹 Nitpick comments (12)
src/Appwrite/Utopia/Response/Model/ColumnPoint.php (1)
24-26: Expose geometry metadata to specs (optional)Consider propagating
$conditionsinto OpenAPI/Swagger via a vendor extension (e.g., x-geo: { type: 'point' }) to help SDKs/clients validate shape. Nice-to-have.src/Appwrite/Utopia/Response/Model/AttributePoint.php (2)
19-19: Prefer float coordinates and clarify order in example.Use realistic float pairs and ensure docs/spec note the order (lng, lat). Low-friction improvement.
Apply this diff:
- 'example' => [0, 0] + 'example' => [12.34, 56.78]
24-26: Document$conditionsshape; consider making it non-mutable.Add a docblock for static analysis; if conventions allow, consider
readonlyor a getter/const to prevent accidental mutation.Apply this docblock:
- public array $conditions = [ + /** @var array{type: 'point'} */ + public array $conditions = [ 'type' => 'point', ];src/Appwrite/Utopia/Response/Model/ColumnLine.php (3)
19-19: Use float coordinate examples for clarity.Minor readability improvement.
Apply this diff:
- 'example' => [[0, 0], [1, 1]] + 'example' => [[12.34, 56.78], [23.45, 67.89]]
24-26: Document$conditionsshape; consider immutability.Match the pattern used in AttributePoint.
Apply this docblock:
- public array $conditions = [ + /** @var array{type: 'linestring'} */ + public array $conditions = [ 'type' => 'linestring', ];
15-20: Call out release-note impact.Changing the schema of the
defaultfield (json → array) is observable to clients. Please add a release note and, if feasible, accept legacy JSON strings for one minor cycle with a warning.tests/e2e/Services/Databases/TablesDB/DatabasesBase.php (2)
8680-8692: Add a failure-case for invalid Line default (single point)
Current test covers the happy path; also assert validator rejects malformed LineString defaults.Example addition right after the success assertions:
+ // invalid: line default must have at least 2 points + $invalidLineDefault = $this->client->call( + Client::METHOD_PATCH, + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/line/route', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + ['default' => [[0, 0]]] + ); + $this->assertEquals(400, $invalidLineDefault['headers']['status-code']);
8708-8717: Add a failure-case for invalid Point default (wrong tuple length)
Strengthens the new array-default contract by asserting invalid shapes are rejected.Example addition after the success assertions:
+ // invalid: point default must be a 2-tuple + $invalidPointDefault = $this->client->call( + Client::METHOD_PATCH, + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/point/location', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + ['default' => [0, 0, 0]] + ); + $this->assertEquals(400, $invalidPointDefault['headers']['status-code']);src/Appwrite/Utopia/Response/Model/AttributeLine.php (1)
24-26: Minor: document expected shape for linestring defaults.Optional: add a short docblock or comment clarifying it’s an array of [x, y] pairs with length ≥ 2.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
46-63: SDK consistency: explicitly set JSON content type (optional)Other endpoints set contentType: JSON in Method. Add it here for consistency across SDKs.
use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; ... ->label('sdk', new Method( namespace: $this->getSdkNamespace(), group: $this->getSdkGroup(), name: self::getName(), description: '/docs/references/databases/create-point-attribute.md', auth: [AuthType::KEY], responses: [ new SDKResponse( code: SwooleResponse::STATUS_CODE_ACCEPTED, model: $this->getResponseModel(), ) ], + contentType: ContentType::JSON, deprecated: new Deprecated(src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
46-63: SDK consistency: add explicit JSON content type (optional)Mirror Update endpoints by specifying contentType in Method.
use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; ... ->label('sdk', new Method( namespace: $this->getSdkNamespace(), group: $this->getSdkGroup(), name: self::getName(), description: '/docs/references/databases/create-line-attribute.md', auth: [AuthType::KEY], responses: [ new SDKResponse( code: SwooleResponse::STATUS_CODE_ACCEPTED, model: $this->getResponseModel(), ) ], + contentType: ContentType::JSON, deprecated: new Deprecated(src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
36-73: Optional: 8000 add an example to reduce ambiguity for polygon coordinate structureIf your routing helpers support examples, consider adding one for
defaultso SDKs generate clearer docs.Example (illustrative only):
- Exterior ring only:
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]- With hole:
[[[...exterior...]], [[...hole...]]]
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (12)
app/config/specs/open-api3-1.8.x-client.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-client.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-client.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-client.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-server.jsonis excluded by!app/config/specs/**
📒 Files selected for processing (18)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php(1 hunks)src/Appwrite/SDK/Specification/Format/OpenAPI3.php(1 hunks)src/Appwrite/SDK/Specification/Format/Swagger2.php(1 hunks)src/Appwrite/Utopia/Database/Validator/Spatial.php(2 hunks)src/Appwrite/Utopia/Response/Model.php(1 hunks)src/Appwrite/Utopia/Response/Model/AttributeLine.php(1 hunks)src/Appwrite/Utopia/Response/Model/AttributePoint.php(1 hunks)src/Appwrite/Utopia/Response/Model/AttributePolygon.php(1 hunks)src/Appwrite/Utopia/Response/Model/ColumnLine.php(1 hunks)src/Appwrite/Utopia/Response/Model/ColumnPoint.php(1 hunks)src/Appwrite/Utopia/Response/Model/ColumnPolygon.php(1 hunks)tests/e2e/Services/Databases/Legacy/DatabasesBase.php(2 hunks)tests/e2e/Services/Databases/TablesDB/DatabasesBase.php(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (4)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (3)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (3)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: E2E Service Test (VCS)
- GitHub Check: E2E Service Test (Migrations)
- GitHub Check: E2E Service Test (Messaging)
- GitHub Check: E2E Service Test (Webhooks)
- GitHub Check: E2E Service Test (Storage)
- GitHub Check: E2E Service Test (Tokens)
- GitHub Check: E2E Service Test (Users)
- GitHub Check: E2E Service Test (Sites)
- GitHub Check: E2E Service Test (Databases/TablesDB)
- GitHub Check: E2E Service Test (Realtime)
- GitHub Check: E2E Service Test (FunctionsSchedule)
- GitHub Check: E2E Service Test (Functions)
- GitHub Check: E2E Service Test (Databases/Legacy)
- GitHub Check: Benchmark
🔇 Additional comments (17)
src/Appwrite/Utopia/Response/Model.php (1)
18-18: Add TYPE_ARRAY constant — looks goodConsistent with the rest of the type constants. No issues.
src/Appwrite/Utopia/Database/Validator/Spatial.php (1)
44-47: No change needed for getType return
self::TYPE_ARRAY correctly resolves to the inherited TYPE_ARRAY constant on Utopia\Validator and poses no undefined‐constant risk.Likely an incorrect or invalid review comment.
src/Appwrite/Utopia/Response/Model/ColumnPoint.php (1)
15-20: Switching default to TYPE_ARRAY with native example is correctMatches the PR goal and aligns with updated validators and specs.
src/Appwrite/Utopia/Response/Model/AttributePoint.php (2)
15-20: LGTM on semantic change.Setting the rule type to array with an array example aligns the model with actual payloads and avoids stringified JSON.
15-20: Verify OpenAPI schema items and validator backward‐compatibility
- In
src/Appwrite/SDK/Specification/Format/OpenAPI3.phpand…/Swagger2.php, confirm array schemas emititems: { type: 'number' }and enforceminItems: 2/maxItems: 2for AttributePoint.- Ensure the
Spatialvalidator still accepts legacy JSON-string defaults (or deprecates them) and add tests covering default arrays.src/Appwrite/Utopia/Response/Model/ColumnLine.php (1)
15-20: The scripts above will locate and inspect theColumnLinemodel and its OpenAPI spec to verify whether nested-item schemas andminItemsrules are defined. Once results are available, I’ll update the review comment accordingly.src/Appwrite/Utopia/Response/Model/ColumnPolygon.php (1)
24-26: Remove visibility-change suggestion and confirm consumer expectations.
$conditionsinColumnPolygon.phpis alreadypublic, matching every other model in this directory.- Verify that downstream consumers indeed expect and handle
['type' => 'polygon']as intended.src/Appwrite/Utopia/Response/Model/AttributeLine.php (1)
15-20: Ensure attribute create/update flows and specs use TYPE_ARRAY without json_decode
VerifiedTYPE_ARRAYinAttributeLineand SDK specs; no directjson_decodeorTYPE_JSONin that flow, butTYPE_JSONremains in other models. Manually confirm the create/update endpoints and OpenAPI specs for this attribute no longer usejson_decodeorTYPE_JSON.src/Appwrite/Utopia/Response/Model/AttributePolygon.php (1)
24-26: Ignore$conditionsconsistency check: NeitherAttributePolygonnorColumnPolygondeclares a$conditionsproperty, so this review comment is outdated.Likely an incorrect or invalid review comment.
tests/e2e/Services/Databases/Legacy/DatabasesBase.php (2)
6562-6569: Point default migrated to array: OKSetting
locationdefault to[0, 0]aligns with the new validator and is validated by the post-create assertions. LGTM.
6539-6541: Approve code changes: no lingering json-encoded spatial defaults remain in tests
Verified via search forjson_encodeintests/e2e/Services/Databases—no matches found.src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
75-87: API type change may break existing clients sending strings$default now expects an array. Clients currently posting JSON strings will receive validation errors. Confirm this is acceptable for 1.8.x, or add a temporary decode fallback to preserve backward compatibility.
Optionally apply:
public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?array $default, ?string $newKey, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents): void { + // Backcompat: accept JSON string defaults + if (is_string($default)) { + $decoded = json_decode($default, true); + if (json_last_error() === JSON_ERROR_NONE) { + $default = $decoded; + } + } $attribute = $this->updateAttribute(src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
75-87: API type change may break existing clients sending strings$default now expects an array. Validate that SDKs and existing integrations won’t regress, or add a decode fallback as a soft migration.
public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?array $default, ?string $newKey, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents): void { + if (is_string($default)) { + $decoded = json_decode($default, true); + if (json_last_error() === JSON_ERROR_NONE) { + $default = $decoded; + } + } $attribute = $this->updateAttribute(src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
75-87: API type change may break existing clients sending strings$default now expects an array. Consider a transition period with string decode support or clearly document the breaking change in release notes.
public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?array $default, ?string $newKey, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents): void { + if (is_string($default)) { + $decoded = json_decode($default, true); + if (json_last_error() === JSON_ERROR_NONE) { + $default = $decoded; + } + } $attribute = $this->updateAttribute(src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
75-86: Behavior change: $default now arrayLooks good, but verify SDKs and clients are updated to send arrays for defaults; otherwise consider a temporary string-decoding fallback as shown below.
public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?array $default, UtopiaResponse $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents): void { + if (is_string($default)) { + $decoded = json_decode($default, true); + if (json_last_error() === JSON_ERROR_NONE) { + $default = $decoded; + } + } $attribute = $this->createAttribute($databaseId, $collectionId, new Document([src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
75-86: Behavior change: $default now arrayChange is consistent with Spatial validator. Ensure client SDKs pass arrays; optionally add a decode fallback to ease migration.
public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?array $default, UtopiaResponse $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents): void { + if (is_string($default)) { + $decoded = json_decode($default, true); + if (json_last_error() === JSON_ERROR_NONE) { + $default = $decoded; + } + } $attribute = $this->createAttribute($databaseId, $collectionId, new Document([src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
75-82: Switching$defaultto?arrayin action() matches the new spatial default contractSignature and pass-through to
Documentlook correct and consistent with other spatial attribute handlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Appwrite/Utopia/Database/Validator/Spatial.php (1)
12-15: Update validator description: value is now an array, not a JSON stringThe message is misleading post-change and will confuse users and docs.
- return 'Value must be a valid spatial type JSON string'; + return 'Value must be a valid spatial structure (array) matching the attribute type (point, linestring, or polygon)';
♻️ Duplicate comments (1)
src/Appwrite/Utopia/Database/Validator/Spatial.php (1)
32-35: Resolved: isArray() correctly returns trueMatches prior feedback; downstream schema generators relying on isArray() will behave correctly.
🧹 Nitpick comments (1)
src/Appwrite/GraphQL/Types/Mapper.php (1)
60-62: Prefer GraphQL list for “array” instead of JSON scalarMapping the generic “array” type to a JSON scalar loses GraphQL list semantics and introspection. Use a list of JSON to reflect “array-of-any”.
- 'any' => Types::json(), - 'array' => Types::json() + 'any' => Types::json(), + 'array' => Type::listOf(Types::json()),
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/Appwrite/GraphQL/Types/Mapper.php(1 hunks)src/Appwrite/Utopia/Database/Validator/Spatial.php(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Linter
- GitHub Check: CodeQL
- GitHub Check: Setup & Build SDK
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: scan
🔇 Additional comments (1)
src/Appwrite/Utopia/Database/Validator/Spatial.php (1)
58-62: All spatial validator call sites now use arrays
Controllers for Line, Point, and Polygon actions declare?array $default, and no JSON strings remain around spatial defaults—validation will succeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/Appwrite/SDK/Specification/Format/Swagger2.php (1)
678-681: Swagger 2: array schema missing required 'items' (repeat of prior review)Arrays in Swagger 2.0 must include an
itemsschema. The new'array'type branch setstypebut notitems, yielding invalid schemas.Apply:
- case 'array': - $type = 'array'; - break; + case 'array': + $type = 'array'; + // Swagger 2 requires 'items' even if element type is unknown. + $items = new \stdClass(); + break;
🧹 Nitpick comments (2)
src/Appwrite/Utopia/Database/Validator/Spatial.php (2)
8-15: Update description: validator now expects arrays, not JSON stringsKeep docs consistent with the new array-based API.
- public function getDescription(): string - { - return 'Value must be a valid spatial type JSON string'; - } + public function getDescription(): string + { + return 'Value must be a valid spatial array (e.g., Point, Line, or Polygon).'; + }
10-23: Expose attribute type to enable better schema/examples (optional)Providing a getter lets spec generators tailor
items/examples per Point/Line/Polygon.public function __construct(string $spatialAttributeType) { $this->spatialAttributeType = $spatialAttributeType; } + + public function getSpatialAttributeType(): string + { + return $this->spatialAttributeType; + }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (8)
app/config/specs/open-api3-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-server.jsonis excluded by!app/config/specs/**
📒 Files selected for processing (3)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php(2 hunks)src/Appwrite/SDK/Specification/Format/Swagger2.php(2 hunks)src/Appwrite/Utopia/Database/Validator/Spatial.php(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Appwrite/SDK/Specification/Format/OpenAPI3.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Benchmark
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build SDK
- GitHub Check: scan
🔇 Additional comments (3)
src/Appwrite/Utopia/Database/Validator/Spatial.php (3)
25-36: LGTM: isArray() correctly returns trueAligns with array-based semantics post-refactor.
37-47: LGTM: getType() returns TYPE_ARRAYMatches base Validator constants and downstream tooling expectations.
58-62: LGTM: Delegation to core SpatialValidatorValidation now happens on native arrays without pre-decoding; consistent with the new contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (12)
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php (2)
61-61: Update spatial column default description across all modules
Replace “as JSON string” with “as array” in the default-value param description in these files:
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php
5-18: Reorder imports alphabetically to satisfy PSR-12Apply:
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Point\Update as PointUpdate; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; -use Utopia\Database\Validator\Spatial; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; +use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable;src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php (2)
5-18: Reorder imports to fix Pint PSR-12 failureSort the use statements alphabetically.
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Polygon\Update as PolygonUpdate; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; -use Utopia\Database\Validator\Spatial; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; +use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable;
61-61: Update description: defaults are arrays, not JSON strings- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for column when not provided, as JSON string. Cannot be set when column is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for column when not provided, as array. Cannot be set when column is required.', true)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php (2)
5-18: Reorder imports to fix Pint PSR-12 failureAlign with ordered_imports.
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Line\Update as LineUpdate; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; -use Utopia\Database\Validator\Spatial; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; +use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable;
61-61: Update description: defaults are arrays, not JSON strings- ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for column when not provided, as JSON string. Cannot be set when column is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for column when not provided, as array. Cannot be set when column is required.', true)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php (2)
9-16: Reorder imports to fix Pint PSR-12 failureAlphabetize and group consistently.
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Point\Create as PointCreate; use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; -use Utopia\Database\Validator\Spatial; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; +use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable;
59-59: Update description: defaults are arrays, not JSON strings- ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for column when not provided, as JSON string. Cannot be set when column is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for column when not provided, as array. Cannot be set when column is required.', true)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php (1)
59-59: Fix parameter description: defaults are arrays, not JSON stringsThe docs still say “as JSON string”, but the validator and ecosystem now expect arrays.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for column when not provided, as JSON string. Cannot be set when column is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for column when not provided, as array. Cannot be set when column is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
67-67: Fix parameter description: defaults are arrays, not JSON stringsUpdate the user-facing text to avoid SDK/client confusion.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as array. Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
67-67: Fix parameter description: defaults are arrays, not JSON stringsAlign docs with behavior.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value for attribute when not provided, as array. Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
67-67: Fix parameter description: defaults are arrays, not JSON stringsUpdate the description to reflect the new input type.
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as array. Cannot be set when attribute is required.', true)
🧹 Nitpick comments (1)
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php (1)
43-54: Explicitly set JSON content type for SDK Method (align with Update endpoints)Small consistency tweak; avoids ambiguity in generated specs/clients.
->label('sdk', new Method( namespace: $this->getSdkNamespace(), group: $this->getSdkGroup(), name: self::getName(), description: '/docs/references/tablesdb/create-point-column.md', auth: [AuthType::KEY], responses: [ new SDKResponse( code: SwooleResponse::STATUS_CODE_ACCEPTED, model: $this->getResponseModel(), ) - ] + ], + contentType: ContentType::JSON ))
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (15)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Att A3E2 ributes/Point/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php(1 hunks)src/Appwrite/SDK/Specification/Format/OpenAPI3.php(1 hunks)src/Appwrite/SDK/Specification/Format/Swagger2.php(1 hunks)src/Appwrite/Utopia/Database/Validator/Spatial.php(0 hunks)
💤 Files with no reviewable changes (1)
- src/Appwrite/Utopia/Database/Validator/Spatial.php
✅ Files skipped from review due to trivial changes (1)
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php
🚧 Files skipped from review as they are similar to previous changes (4)
- src/Appwrite/SDK/Specification/Format/Swagger2.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php
🧰 Additional context used
🧬 Code graph analysis (3)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
🪛 GitHub Actions: Linter
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php
[error] 1-1: Pint: PSR-12 ordered_imports violation detected. Reorder imports to satisfy Pint's ordered_imports rule. Command: 'vendor/bin/pint --test --config pint.json'
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build SDK
- GitHub Check: scan
🔇 Additional comments (11)
src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php (2)
5-17: Resolve Pint PSR-12 ordered_imports failureImports need reordering per Pint’s ordered_imports rule. Please run vendor/bin/pint to auto-fix.
9-9: Confirmed composer dependency covers the shared Spatial validator
composer.json requires"utopia-php/database": "1.*", which includes the Utopia\Database\Validator\Spatial class; no lingering old imports detected.src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (3)
12-12: Import switch to Utopia Spatial validatorLooks correct; ensure dependency alignment with utopia-php/database providing this class.
Use the same script as above to verify composer.json and stray imports.
75-75: Signature change to ?array $default is aligned with new contractLGTM.
5-20: Resolve Pint PSR-12 ordered_imports failureImports require reordering. Run vendor/bin/pint.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (3)
12-12: Import switch to Utopia Spatial validatorConsistent with the PR direction; please verify dependency version provides the class.
75-75: Signature change to ?array $default is aligned with new contractLGTM.
5-20: Resolve Pint PSR-12 ordered_imports failurePlease run vendor/bin/pint to reorder imports.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (3)
12-12: Import switch to Utopia Spatial validatorOK; ensure utopia-php/database version contains Spatial.
75-75: Signature change to ?array $default is aligned with new contractLGTM.
5-21: Resolve Pint PSR-12 ordered_imports failureRun vendor/bin/pint to satisfy ordered_imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
67-67: Parameter description still says "JSON string" but input is now array.Update the user-facing text to avoid confusion.
Apply this diff:
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POINT)), 'Default value for attribute when not provided, as array. Cannot be set when attribute is required.', true)src/Appwrite/Platform/Modules/Databases/H 67DE ttp/Databases/Collections/Attributes/Polygon/Create.php (1)
67-67: Parameter description still says "JSON string" but input is now array.Align the docs with the new input type.
Apply this diff:
- ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.', true) + ->param('default', null, new Nullable(new Spatial(Database::VAR_POLYGON)), 'Default value for attribute when not provided, as array. Cannot be set when attribute is required.', true)
🧹 Nitpick comments (2)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (2)
64-65: Inconsistent docs anchor for "create collection".This file uses
#databasesCreateCollectionwhile Point/Update uses#createCollection. Standardize and verify the correct anchor to avoid broken links.If
#createCollectionis the canonical anchor, apply:- ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') + ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).')
46-63: Be explicit about SDK request content type for consistency.Point/Update sets
contentType: ContentType::JSON. Consider mirroring that here for clarity.Apply this diff:
+use Appwrite\SDK\ContentType; @@ ->label('sdk', new Method( namespace: $this->getSdkNamespace(), group: $this->getSdkGroup(), name: self::getName(), description: '/docs/references/databases/create-polygon-attribute.md', auth: [AuthType::KEY], responses: [ new SDKResponse( code: SwooleResponse::STATUS_CODE_ACCEPTED, model: $this->getResponseModel(), ) ], + contentType: ContentType::JSON, deprecated: new Deprecated( since: '1.8.0', replaceWith: 'tablesDB.createPolygonColumn', ), ))
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (9)
app/config/specs/open-api3-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-server.jsonis excluded by!app/config/specs/**composer.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php
- src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php
- src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php
🧰 Additional context used
🧬 Code graph analysis (2)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php (1)
action(75-87)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (1)
action(75-92)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php (1)
action(75-92)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
- GitHub Check: E2E Service Test (VCS)
- GitHub Check: Benchmark
- GitHub Check: E2E Service Test (Health)
- GitHub Check: E2E Service Test (Realtime)
- GitHub Check: E2E Service Test (Webhooks)
- GitHub Check: E2E Service Test (Functions)
- GitHub Check: E2E Shared Mode Service Test (Site Screenshots) (Shared V1)
- GitHub Check: E2E Service Test (Account)
- GitHub Check: E2E Shared Mode Service Test (Site Screenshots) (Shared V2)
- GitHub Check: E2E Shared Mode Service Test (Dev Keys) (Shared V2)
- GitHub Check: E2E Service Test (Site Screenshots)
- GitHub Check: E2E Service Test (Dev Keys)
- GitHub Check: Unit Test
- GitHub Check: E2E General Test
- GitHub Check: Setup & Build SDK
- GitHub Check: scan
🔇 Additional comments (4)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php (2)
15-15: Import switch to core Spatial validator looks correct.Using Utopia\Database\Validator\Spatial aligns with the validator consolidation in Utopia.
75-87: API surface changes: confirm backward compatibility plan for clients sending JSON strings.Changing the method signature to
?array $defaultand removing decode will reject legacy string inputs. On a 1.8.x branch, this may be a breaking change unless clearly intended and documented.Please confirm:
- Are we OK breaking legacy string defaults in 1.8.x? If not, I can draft a compatibility layer (accept both array and legacy JSON string) and update the validator/docs accordingly.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php (2)
16-16: Import switch to core Spatial validator looks correct.Consistent with the rest of the PR.
75-87: API surface changes: confirm backward compatibility plan for clients sending JSON strings.Same concern as Point/Update: array-only defaults may break existing 1.8 clients.
If we need transitional compatibility, I can propose a dual-accept approach and corresponding SDK/OpenAPI notes.
…ve error during sdk gen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/Appwrite/SDK/Specification/Format/Swagger2.php (1)
686-689: Swagger 2 definitions: 'array' properties must include 'items'In model definitions, the new
case 'array'setstype: arraybut never assignsitems, yielding invalid Swagger 2 schemas. Add a defaultitemsschema (e.g.,{}) so downstream tools accept the output.Apply:
- case 'array': - $type = 'array'; - break; + case 'array': + $type = 'array'; + // Swagger 2.0 requires 'items' for arrays. Use an open schema by default. + $items = new \stdClass(); + break;
🧹 Nitpick comments (1)
src/Appwrite/SDK/Specification/Format/Swagger2.php (1)
465-469: Spatial params: correct array typing; prefer a typed example and reuse provided examplesSetting
type: arraywithitems: {}satisfies Swagger 2. Consider emitting a typed example (array) and prefer$param['example']when present for consistency with payload schemas.Apply:
case 'Utopia\Database\Validator\Spatial': $node['type'] = 'array'; $node['items'] = new \stdClass(); - $node['x-example'] = '[[1,2], [3, 4]]'; + // Use provided example when available; otherwise default to an empty array. + $node['x-example'] = $param['example'] ?? []; break;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (8)
app/config/specs/open-api3-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-server.jsonis excluded by!app/config/specs/**
📒 Files selected for processing (2)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php(2 hunks)src/Appwrite/SDK/Specification/Format/Swagger2.php(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Appwrite/SDK/Specification/Format/OpenAPI3.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php (1)
683-686: OpenAPI: array schema missing required 'items' when rule['array'] is falseThis recreates the previously flagged issue:
type: arraywithoutitemsis invalid in OpenAPI 3. Ensureitemsis always present. The 67DE snippet below setsitems: {}only when the rule itself isn’t an array-of-something.Apply:
- case 'array': - $type = 'array'; - break; + case 'array': + $type = 'array'; + // Ensure valid OpenAPI: arrays require 'items'. + // Only set a default when not an array-of-something. + if (!($rule['array'] ?? false)) { + $items = new \stdClass(); // array<any> + } + break;After the change, quickly grep generated schemas to ensure no
type: arrayproperties lackitems:#!/bin/bash # Look for array properties without items in generated OpenAPI (if artifacts exist) # Otherwise, scan the builder source for obvious misses. rg -nP "['\"]type['\"]\s*=>\s*['\"]array['\"](?!.*['\"]items['\"])"
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (8)
app/config/specs/open-api3-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/open-api3-latest-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-1.8.x-server.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-console.jsonis excluded by!app/config/specs/**app/config/specs/swagger2-latest-server.jsonis excluded by!app/config/specs/**
📒 Files selected for processing (2)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php(2 hunks)src/Appwrite/SDK/Specification/Format/Swagger2.php(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Appwrite/SDK/Specification/Format/Swagger2.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build SDK
- GitHub Check: scan
What does this PR do?
(Provide a description of what this PR does and why it's needed.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)
Related PRs and Issues
Checklist