-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Apple SDK update for version 13.0.0 #87
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
Conversation
Walkthrough
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
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. Comment |
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 (1)
Sources/AppwriteModels/Execution.swift (1)
133-139
: Avoid force-unwrapping enum(rawValue:) to prevent crashes on unknown values.When the backend introduces a new trigger/status string,
ExecutionTrigger(rawValue:)!
orExecutionStatus(rawValue:)!
will trap, taking down clients—a regression from the old String-based model. We need to fail gracefully during decoding and provide a safe fallback when mapping dictionaries.- self.trigger = AppwriteEnums.ExecutionTrigger(rawValue: try container.decode(String.self, forKey: .trigger))! - self.status = AppwriteEnums.ExecutionStatus(rawValue: try container.decode(String.self, forKey: .status))! + let triggerValue = try container.decode(String.self, forKey: .trigger) + guard let trigger = AppwriteEnums.ExecutionTrigger(rawValue: triggerValue) else { + throw DecodingError.dataCorruptedError( + forKey: .trigger, + in: container, + debugDescription: "Unsupported trigger value: \(triggerValue)" + ) + } + self.trigger = trigger + + let statusValue = try container.decode(String.self, forKey: .status) + guard let status = AppwriteEnums.ExecutionStatus(rawValue: statusValue) else { + throw DecodingError.dataCorruptedError( + forKey: .status, + in: container, + debugDescription: "Unsupported status value: \(statusValue)" + ) + } + self.status = status @@ - trigger: ExecutionTrigger(rawValue: map["trigger"] as! String)!, - status: ExecutionStatus(rawValue: map["status"] as! String)!, + trigger: ExecutionTrigger(rawValue: map["trigger"] as? String ?? "") ?? .http, + status: ExecutionStatus(rawValue: map["status"] as? String ?? "") ?? .waiting,Also applies to: 201-203
🧹 Nitpick comments (2)
Sources/AppwriteEnums/ExecutionTrigger.swift (1)
4-6
: Remove redundant raw-value assignments to satisfy SwiftLint.The explicit
= "http"
/= "schedule"
/= "event"
assignments duplicate the case names and trigger SwiftLint’sredundant_string_enum_value
warning. Dropping the raw-value literals keeps the enum cleaner and avoids the warning.- case http = "http" - case schedule = "schedule" - case event = "event" + case http + case schedule + case eventSources/AppwriteEnums/ExecutionStatus.swift (1)
4-7
: Drop redundant raw values to silence SwiftLint.These raw-value literals match the case identifiers exactly, so SwiftLint flags them as redundant. Letting Swift infer the
String
raw values keeps the enum tidy and resolves the warning.- case waiting = "waiting" - case processing = "processing" - case completed = "completed" - case failed = "failed" + case waiting + case processing + case completed + case failed
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
README.md
(1 hunks)Sources/Appwrite/Client.swift
(2 hunks)Sources/AppwriteEnums/ExecutionStatus.swift
(1 hunks)Sources/AppwriteEnums/ExecutionTrigger.swift
(1 hunks)Sources/AppwriteModels/Document.swift
(1 hunks)Sources/AppwriteModels/Execution.swift
(7 hunks)Sources/AppwriteModels/Preferences.swift
(1 hunks)Sources/AppwriteModels/Row.swift
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
Sources/AppwriteModels/Document.swift (2)
Sources/AppwriteModels/Preferences.swift (1)
from
(38-42)Sources/AppwriteModels/DocumentList.swift (1)
from
(48-53)
Sources/AppwriteModels/Row.swift (2)
Sources/AppwriteModels/Document.swift (1)
from
(101-112)Sources/AppwriteModels/Preferences.swift (1)
from
(38-42)
Sources/AppwriteModels/Preferences.swift (1)
Sources/AppwriteModels/Document.swift (1)
from
(101-112)
🪛 SwiftLint (0.57.0)
Sources/AppwriteEnums/ExecutionTrigger.swift
[Warning] 4-4: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
[Warning] 5-5: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
[Warning] 6-6: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
Sources/AppwriteModels/Execution.swift
[Error] 201-201: Force casts should be avoided
(force_cast)
[Error] 202-202: Force casts should be avoided
(force_cast)
Sources/AppwriteModels/Document.swift
[Error] 110-110: Force tries should be avoided
(force_try)
Sources/AppwriteModels/Row.swift
[Error] 110-110: Force tries should be avoided
(force_try)
Sources/AppwriteEnums/ExecutionStatus.swift
[Warning] 4-4: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
[Warning] 5-5: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
[Warning] 6-6: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
[Warning] 7-7: String enum values can be omitted when they are equal to the enumcase name
(redundant_string_enum_value)
Sources/AppwriteModels/Preferences.swift
[Error] 40-40: Force tries should be avoided
(force_try)
🔇 Additional comments (6)
Sources/Appwrite/Client.swift (2)
26-26
: LGTM! Version header updated correctly.The SDK version header has been updated to reflect the 12.2.0 release, consistent with the PR objectives and the version bump in README.md.
357-357
: Excellent improvement: warnings now properly logged to stderr.Redirecting warnings from stdout to stderr is the correct approach, ensuring warnings don't interfere with regular output and follow standard Unix conventions.
Sources/AppwriteModels/Row.swift (1)
110-110
: LGTM! Data decoding updated with proper fallback.The change to decode from
map["data"]
with a fallback to the entiremap
provides flexibility for different response structures. This pattern is consistently applied across Row, Document, and Preferences models.Note: The
force_try
flagged by static analysis appears to be part of the existing SDK pattern for these generated models, where decoding failures would indicate a critical SDK-server contract violation.README.md (1)
34-34
: LGTM! Documentation updated to reflect the new SDK version.The Swift Package Manager example now correctly references version 12.2.0, ensuring users will pull the updated SDK.
Sources/AppwriteModels/Document.swift (1)
110-110
: LGTM! Consistent data decoding pattern applied.The data decoding logic matches the pattern used in Row and Preferences models, ensuring consistent behavior across the SDK when handling nested data structures.
Sources/AppwriteModels/Preferences.swift (1)
40-40
: LGTM! Final model updated with consistent data decoding.This completes the consistent application of the nested data decoding pattern across Preferences, Document, and Row models, ensuring uniform handling of API responses throughout the SDK.
This PR contains updates to the Apple SDK for version 13.0.0.
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Chores