feat(entities): support v1, v2, and v3 Data Fabric entities APIs#1799
Open
RohanKharvi1211 wants to merge 1 commit into
Open
feat(entities): support v1, v2, and v3 Data Fabric entities APIs#1799RohanKharvi1211 wants to merge 1 commit into
RohanKharvi1211 wants to merge 1 commit into
Conversation
The entities SDK previously talked to the Data Service through hardcoded endpoint strings with no version concept. Add selectable v2 and v3 surfaces alongside the existing (unchanged) v1 `sdk.entities`: - `sdk.entities` -> v1 (unchanged) - `sdk.entities_v2` -> v2 (partial: query + read + list_entities, v1 models) - `sdk.entities_v3` -> v3 (mirrors the v1 op set on /api/v3/entities/*, returning new V3 models) v2 shares v1's wire shape, so `EntitiesServiceV2` reuses v1 parsing/models and only re-points endpoints; it exposes exactly what the v2 backend implements. v3 is a redesign: new models in `entities_v3.py` (`EntityWriteResponseV3` with the root-field flattening converter, `QueryResponseV3`, `BatchOperationResponse`, `EntityRecordV3`, `CompositeEntityMetadataResponse`, `GetAllResponseV3`). Federated SQL and entity-set resolution stay version-agnostic; CSV import raises NotImplementedError on v3 (no v3 endpoint). Extracted the shared `build_query_body()` helper (used by v1/v2/v3). No change to v1 behavior — all 130 existing entity tests pass; 22 new v2/v3 tests added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds version-aware Entities SDK surfaces so consumers can choose v1 (existing), v2 (limited surface), or v3 (new models + routing) Data Fabric entities APIs without changing v1 behavior.
Changes:
- Introduces
EntitiesServiceV2andEntitiesServiceV3facades and wires them intoUiPathPlatformassdk.entities_v2/sdk.entities_v3. - Adds v3-specific response models (notably
EntityWriteResponseV3with fold/flatten behavior) plus v3 schema/data service implementations targeting/datafabric_/api/v3/entities/.... - Refactors shared structured-query body construction into
build_query_body()and reuses it across v1/v2/v3.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/uipath-platform/tests/services/test_entities_v3_service.py | Adds v3 facade + v3 model behavior tests (endpoints, batch, composite metadata, NotImplementedError). |
| packages/uipath-platform/tests/services/test_entities_v2.py | Adds v2 facade tests for endpoint routing and intentionally-missing operations. |
| packages/uipath-platform/src/uipath/platform/entities/entities_v3.py | Introduces v3 response models (flattened envelope + composite metadata/catalog types). |
| packages/uipath-platform/src/uipath/platform/entities/_entity_schema_service_v3.py | Adds v3 schema HTTP service targeting /api/v3/entities and returning v3 schema models. |
| packages/uipath-platform/src/uipath/platform/entities/_entity_data_service.py | Extracts build_query_body() and switches v1 structured query builder to use it. |
| packages/uipath-platform/src/uipath/platform/entities/_entity_data_service_v3.py | Adds v3 data HTTP service (CRUD/query/batch/attachments/choicesets) targeting /api/v3/entities/.... |
| packages/uipath-platform/src/uipath/platform/entities/_entities_service_v3.py | Adds public v3 facade (EntitiesServiceV3) composing schema+data services and delegating federated SQL to v1. |
| packages/uipath-platform/src/uipath/platform/entities/_entities_service_v2.py | Adds public v2 facade (EntitiesServiceV2) exposing only the v2 backend’s supported operations. |
| packages/uipath-platform/src/uipath/platform/entities/init.py | Exports v2/v3 facades and v3 models from the uipath.platform.entities package surface. |
| packages/uipath-platform/src/uipath/platform/_uipath.py | Wires entities_v2/entities_v3 onto the main SDK entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+475
to
+485
| @staticmethod | ||
| def _choiceset_values_spec( | ||
| choiceset_id: str, | ||
| start: Optional[int] = None, | ||
| limit: Optional[int] = None, | ||
| ) -> RequestSpec: | ||
| return RequestSpec( | ||
| method="POST", | ||
| endpoint=Endpoint(f"{_V3_BASE}/entity/{choiceset_id}/query_expansion"), | ||
| json=build_query_body(start=start, limit=limit), | ||
| ) |
Comment on lines
+66
to
+70
| self._routing_strategy: RoutingStrategy = ( | ||
| routing_strategy | ||
| if routing_strategy is not None | ||
| else create_routing_strategy( | ||
| folders_map=folders_map, |
Comment on lines
+397
to
+401
| def upload_attachment( | ||
| self, | ||
| entity_id: str, | ||
| record_id: str, | ||
| field_name: str, |
Comment on lines
+213
to
+217
| def get_choiceset_values( | ||
| self, | ||
| choiceset_id: str, | ||
| start: Optional[int] = None, | ||
| limit: Optional[int] = None, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds selectable v2 and v3 Entities API surfaces alongside the existing (unchanged) v1
sdk.entities. The entities SDK previously used hardcoded endpoint strings with no version concept; this introduces version-aware access points without altering v1 behavior.sdk.entities→ v1 (unchanged, default)sdk.entities_v2→ v2 — partial surface (the v2 backend only implementsretrieve_records(query),get_record(read by id), andlist_entities); reuses v1 models/parsing, only re-points endpoints to/api/v2/...sdk.entities_v3→ v3 — mirrors the v1 operation set on/api/v3/entities/*, returning new v3 response modelsv3 models (
entities_v3.py)EntityWriteResponseV3— replicates the backend's flattening: root-entity fields fold intoroot_fieldson parse and re-flatten to the top level on dump;updatedCountomitted when zeroQueryResponseV3,BatchOperationResponse,EntityRecordV3,CompositeEntityMetadataResponse(composite/member aware),GetAllResponseV3, plusChildArrayBlockhelpersNotes / scope
query_entity_records) and entity-set resolution are version-agnostic and delegate to the shared engine.import_records(CSV bulk upload) has no v3 endpoint → raisesNotImplementedErroron v3.build_query_body()used by v1/v2/v3 (pure refactor).{entityName}), matching how existing SDK examples pass entity names asentity_key.create_entityreuses v1'sentityDefinitionpayload shape (the v3 controller accepts a generic body).Testing
build_query_bodyextraction preserves v1 behavior).EntityWriteResponseV3flatten round-trip, composite metadata, batch,NotImplementedError).uipath-platformsuite: 1361 passed, 11 skipped.ruff check,ruff format --check, andmypyclean on all touched files.🤖 Generated with Claude Code