Skip to content

Conversation

@BimsaraBodaragama
Copy link
Contributor

@BimsaraBodaragama BimsaraBodaragama commented Dec 17, 2025

Purpose

Update the User Sharing v2 request models to better support API-layer/Jackson deserialization and standardize PATCH role-update inputs, while keeping service contracts consistent.

Goals

  • Add no-args + minimal constructors for request DOs to support framework binding (e.g., GetUserSharedOrgsDO, PatchOperationDO).
  • Replace the older role-update request shape with a PATCH-specific model (UserSharePatchDO + PatchOperationDO) and a clearer operation enum (UserSharePatchOperation).
  • Update UserSharingPolicyHandlerServiceV2 and UserSharingPolicyHandlerServiceImplV2 to accept the new PATCH DO type.

Approach

  • Enhance GetUserSharedOrgsDO with a default constructor and a minimal (userId, parentOrgId) constructor in addition to the full constructor.
  • Refactor PATCH-related models:
    • Rename/introduce PatchOperationDO (from RoleAssignmentUpdateDO) and switch operation type to UserSharePatchOperation.
    • Rename/introduce UserSharePatchOperation (from RoleAssignmentOperation) while keeping supported operations (add, remove) and fromValue.
    • Add UserSharePatchDO as the request container with List<PatchOperationDO> patchOperations (and setters/getters for binding).
  • Update the v2 service interface + impl method signature to use UserSharePatchDO (and align Javadoc accordingly).

Note: A few newly introduced public request/operation types were renamed in this PR to better align with the User Sharing v2 PATCH model. These types were added as part of recent scaffolding [Service layer scaffolding - Part 1][Service layer scaffolding - Part 2] and are not yet consumed outside this module, so the renaming does not introduce any external impact.

Related PRs

Related Issues

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.19%. Comparing base (b984fee) to head (038847e).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...n/user/sharing/models/dos/GetUserSharedOrgsDO.java 0.00% 7 Missing ⚠️
...tion/user/sharing/models/dos/UserSharePatchDO.java 0.00% 4 Missing ⚠️
...tion/user/sharing/models/dos/PatchOperationDO.java 0.00% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #590   +/-   ##
=========================================
  Coverage     53.18%   53.19%           
  Complexity     2160     2160           
=========================================
  Files           213      213           
  Lines         13327    13325    -2     
  Branches       2195     2195           
=========================================
  Hits           7088     7088           
+ Misses         5551     5549    -2     
  Partials        688      688           
Flag Coverage Δ
unit 38.04% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the User Sharing v2 request data objects (DOs) to enhance API-layer/Jackson deserialization support and standardize PATCH operation models. The changes include adding constructors to support framework binding, renaming classes for better clarity, and updating service layer method signatures to use the new model types.

Key Changes:

  • Added no-args and minimal constructors to request DOs (GetUserSharedOrgsDO, PatchOperationDO) for Jackson deserialization support
  • Refactored PATCH models by renaming PatchUserShareDOUserSharePatchDO, RoleAssignmentUpdateDOPatchOperationDO, and RoleAssignmentOperationUserSharePatchOperation
  • Updated service interface and implementation to use the new UserSharePatchDO type and corrected exception types from OrganizationManagementException to UserSharingMgtException

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
UserSharePatchDO.java New PATCH request model extending BaseUserShareDO with patchOperations field
PatchUserShareDO.java Deleted old PATCH model in favor of the new UserSharePatchDO
PatchOperationDO.java Renamed from RoleAssignmentUpdateDO, added no-args constructor for deserialization
UserSharePatchOperation.java Renamed enum from RoleAssignmentOperation for better naming clarity
GetUserSharedOrgsDO.java Added no-args and minimal constructors for framework binding support
UserSharingPolicyHandlerServiceV2.java Updated method signature to use UserSharePatchDO and corrected exception types in Javadoc
UserSharingPolicyHandlerServiceImplV2.java Updated implementation method signature to match interface changes
Comments suppressed due to low confidence (1)

components/org.wso2.carbon.identity.organization.management.organization.user.sharing/src/main/java/org/wso2/carbon/identity/organization/management/organization/user/sharing/models/dos/PatchOperationDO.java:33

  • According to the custom coding guidelines, all public methods should have a docstring. The no-args constructor should include a Javadoc comment explaining its purpose, such as being used for Jackson deserialization or framework binding.

@BimsaraBodaragama
Copy link
Contributor Author

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review. ✅ Project coverage is 53.19%. Comparing base (b984fee) to head (038847e).

Files with missing lines Patch % Lines
...n/user/sharing/models/dos/GetUserSharedOrgsDO.java 0.00% 7 Missing ⚠️
...tion/user/sharing/models/dos/UserSharePatchDO.java 0.00% 4 Missing ⚠️
...tion/user/sharing/models/dos/PatchOperationDO.java 0.00% 3 Missing ⚠️
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

@@            Coverage Diff            @@
##               main     #590   +/-   ##
=========================================
  Coverage     53.18%   53.19%           
  Complexity     2160     2160           
=========================================
  Files           213      213           
  Lines         13327    13325    -2     
  Branches       2195     2195           
=========================================
  Hits           7088     7088           
+ Misses         5551     5549    -2     
  Partials        688      688           

Flag Coverage Δ
unit 38.04% <0.00%> (+<0.01%) ⬆️
Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:

Codecov fails because this PR is scaffold-only (new models/skeleton code) and no tests or runnable paths were added yet to cover these new lines. Coverage will be added with the upcoming implementation PR(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants