deprecate the metadata fields in user update#650
Conversation
📝 WalkthroughWalkthroughThis pull request adds support for updating user metadata with RFC 7396 JSON Merge Patch semantics. The change includes a Clerk API version bump to 1.0.17, a new PATCH /v1/me/metadata endpoint, an RFC 7396-compliant merge-patch algorithm that recursively merges objects and removes keys with null values, a rewritten User.update() method that conditionally routes metadata through the new endpoint, and comprehensive test coverage for serialization, integration, and routing behavior including HTTP interception tests. Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
|
@brunol95 made some changes to simplify a bit |
@swolfand thanks! Theres one thing I missed - the merge patch logic for metadata uses the locally cached metadata object but we can't guarantee that it has the latest data. Here's my planned fix.
|
|
@brunol95 new changes look reasonable to me! |
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 changeTodos
Summary of changes
User.update({ unsafeMetadata, … })into PATCH/v1/me+ PATCH /v1/me/metadatato match the new FAPI shape, preserving replace-semantics via an RFC 7396 merge patch computed locally.User.updateMetadata(params + JsonObject overload) and theUserApi.updateUserMetadataRetrofit endpoint at the new User.METADATA path.User.updateandcomputeMergePatchMergePatchTest,UserUpdateRoutingTest(covers all routing cases + the staleness regression),UpdateMetadataOverloadTest, plusUpdateMetadataParamscases inUserTest.