deprecate metadata field in user update#415
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR adds a dedicated metadata update API to the Clerk iOS SDK with RFC 7396 merge-patch computation. It introduces Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Sources/ClerkKit/Domains/User/UserUpdateParams.swift (1)
8-99:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFix CI lint blockers before merge.
Required checks are currently failing (
SwiftFormatin this file and also inSources/ClerkKit/Utils/JSON+MergePatch.swiftandTests/Utils/JSONMergePatchTests.swift), so this PR is not mergeable yet.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Sources/ClerkKit/Domains/User/UserUpdateParams.swift` around lines 8 - 99, CI is failing due to SwiftFormat lint violations; run the project's SwiftFormat configuration and fix formatting in the affected files (Sources/ClerkKit/Domains/User/UserUpdateParams.swift — symbols: User.UpdateParams, hasAnyField, _unsafeMetadata, unsafeMetadata, CodingKeys — plus Sources/ClerkKit/Utils/JSON+MergePatch.swift and Tests/Utils/JSONMergePatchTests.swift), stage the formatted files, and push the updated files so the SwiftFormat check passes; re-run the CI to confirm all lint blockers are resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/ClerkKit/Domains/User/User.swift`:
- Line 251: Replace the source used to compute the merge patch from
self.unsafeMetadata to afterPatch.unsafeMetadata so deletions account for any
server-side additions; specifically, in the User update flow where you set let
current = self.unsafeMetadata ?? .object([:]) (in User.swift), change it to
derive current from afterPatch.unsafeMetadata (e.g., let current =
afterPatch.unsafeMetadata ?? .object([:])) so the generated patch includes nulls
for keys the server added and achieves true replace semantics when building the
merge patch.
- Around line 243-250: Replace the multi-statement conditional with a single
expression assignment for afterPatch and remove the redundant self and extra
blank line: change the block that declares afterPatch to a single-line
conditional assignment using rest.hasAnyField ? try await service.update(params:
rest) : self (ensuring parentheses around the try await call if needed), remove
the redundant "self." in the fallback, and delete the consecutive blank line.
---
Outside diff comments:
In `@Sources/ClerkKit/Domains/User/UserUpdateParams.swift`:
- Around line 8-99: CI is failing due to SwiftFormat lint violations; run the
project's SwiftFormat configuration and fix formatting in the affected files
(Sources/ClerkKit/Domains/User/UserUpdateParams.swift — symbols:
User.UpdateParams, hasAnyField, _unsafeMetadata, unsafeMetadata, CodingKeys —
plus Sources/ClerkKit/Utils/JSON+MergePatch.swift and
Tests/Utils/JSONMergePatchTests.swift), stage the formatted files, and push the
updated files so the SwiftFormat check passes; re-run the CI to confirm all lint
blockers are resolved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d8551876-c9ad-4acd-bc8d-52a6a19684fe
📒 Files selected for processing (10)
Sources/ClerkKit/Domains/User/User.swiftSources/ClerkKit/Domains/User/UserService.swiftSources/ClerkKit/Domains/User/UserUpdateMetadataParams.swiftSources/ClerkKit/Domains/User/UserUpdateParams.swiftSources/ClerkKit/Mocks/MockServices/MockUserService.swiftSources/ClerkKit/Utils/JSON+MergePatch.swiftSources/ClerkKit/Utils/Version.swiftTests/Domains/User/UserUpdateMetadataTests.swiftTests/Domains/User/UserUpdateRoutingTests.swiftTests/Utils/JSONMergePatchTests.swift
56a8cf0 to
63ef50a
Compare
In the next API version we introducing a breaking change. Metadata updates will not be accepted via the PATCH
/v1/meendpoint. This PR updates the sdk to be backwards compatible with this changeSummary of changes
explicitly passes unsafeMetadata:.
surface at the initializer call site too.
deprecated) to suppress the new warnings: