Skip to content

Conversation

@may-hartov
Copy link
Collaborator

Summary

Public Fabric APIs for updating resources (capacities, workspaces, items, etc.) are exposed as REST PATCH operations and expect request bodies to include only the fields being changed.
Our CLI set command previously fetched the full resource payload via GET, modified a single field (for example, displayName), and sent the entire object back to the update endpoint. This behavior does not align with PATCH semantics and can result in unexpected behavior or validation errors.
This PR refactors the update flow to construct PATCH request bodies correctly by extracting only the updated properties from the GET response.

Changes

  • fab_cmd_set_utils:

    1. Extracted update_item_definition from update_fabric_element, as it is item-specific.
    2. Removed json_payload from update_fabric_element return values (unused by callers).
    3. Added extract_updated_only: bool = True to update_fabric_element to control whether only the updated path is extracted or the full payload is returned. For OneLake shortcut updates, this flag is set to False, since shortcuts use the Create API rather than an Update API.
    4. Introduced update_cache to reduce code duplication across fab_fs_set_* implementations.
  • fab_fs_set_*
    Removed data.pop(...) calls. Since the payload now includes only the target path being updated, fields like id are no longer present and do not need to be stripped.

  • fab_fs_set_connection
    Added connectivityType to the payload, as required by the Update Gateway API documentation.

  • fab_fs_set_gateway
    Added the required type field, per the [Update Gateway API documentation.]((https://learn.microsoft.com/en-us/rest/api/fabric/core/connections/update-gateway).

Tests
Because this change affects how request payloads are constructed for update APIs, all set command tests were re-recorded to reflect the new behavior.

@may-hartov may-hartov requested a review from a team as a code owner January 1, 2026 14:14
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.

1 participant