Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/neat-jobs-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@itwin/scenes-client": patch
---

Add optional `description` field to SceneObject interfaces. Enables detailed object descriptions alongside display names.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface BaseSceneObjectCreate<
id?: string;
/** Optional display name for the scene object */
displayName?: string;
/** Optional detailed description of the scene object */
description?: string;
/** Optional number for the scene object's order in lists. */
order?: number;
/** Optional stacking order for clients to control rendering sequence. Objects with lower values are typically drawn beneath objects with higher values.*/
Expand Down Expand Up @@ -102,6 +104,7 @@ export function isSceneObjectCreate(v: unknown): v is SceneObjectCreate {
isObject(v) &&
(v.id === undefined || typeof v.id === "string") &&
(v.displayName === undefined || typeof v.displayName === "string") &&
(v.description === undefined || typeof v.description === "string") &&
(v.order === undefined || typeof v.order === "number") &&
(v.displayOrder === undefined || typeof v.displayOrder === "number") &&
(v.visible === undefined || typeof v.visible === "boolean") &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface SceneObjectUpdate<
order?: number | null;
/** Optional stacking order for clients to control rendering sequence. Objects with lower values are typically drawn beneath objects with higher values. Pass `null` to remove. */
displayOrder?: number | null;
/** Optional detailed description of the scene object. Pass `null` to remove. */
description?: string | null;
/** Optional parent Id for the scene object (UUID). Pass `null` to remove. */
parentId?: string | null;
/** Optional visibility state for the scene object. Pass `null` to remove. */
Expand Down
6 changes: 4 additions & 2 deletions packages/scenes-client/tests/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,19 +262,21 @@ describe("Scenes Objects operations", () => {
iTwinId: ITWIN_ID,
sceneId,
objectId: obj1,
object: { displayName: undefined, order: 2, displayOrder: 5 },
object: { displayName: undefined, description: "TestDescription", order: 2, displayOrder: 5 },
});
expect(p1.object.displayName).toBe("TestLayer"); // ignored displayName
expect(p1.object.description).toBe("TestDescription"); // updated description
expect(p1.object.order).toBe(2); // updated order
expect(p1.object.displayOrder).toBe(5); // updated displayOrder

const p2 = await client.patchObject({
iTwinId: ITWIN_ID,
sceneId,
objectId: obj1,
object: { displayName: null, order: null, displayOrder: null },
object: { displayName: null, description: null, order: null, displayOrder: null },
});
expect(p2.object.displayName).toBe(undefined); // removed displayName
expect(p2.object.description).toBe(undefined); // removed description
expect(p2.object.order).toBe(undefined); // removed order
expect(p2.object.displayOrder).toBe(undefined); // removed displayOrder
});
Expand Down
12 changes: 6 additions & 6 deletions packages/scenes-client/tests/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,15 @@ describe("Scene Object Operations", () => {
it("patchObject()", async () => {
fetchMock.mockImplementation(() => createSuccessfulResponse(exampleSceneObjectResponse));
const client = new SceneClient(getAccessToken);
const updateData = {
displayName: "Updated Object",
description: "Updated Description",
};
await client.patchObject({
iTwinId: "itw-1",
sceneId: "scene-1",
objectId: "object-1",
object: {
displayName: "UpdatedObject1",
},
object: updateData,
});
verifyFetch(fetchMock, {
url: `${BASE_DOMAIN}/scene-1/objects/object-1?iTwinId=itw-1`,
Expand All @@ -312,9 +314,7 @@ describe("Scene Object Operations", () => {
Accept: "application/vnd.bentley.itwin-platform.v1+json",
},
method: "PATCH",
body: JSON.stringify({
displayName: "UpdatedObject1",
}),
body: JSON.stringify(updateData),
});
});

Expand Down
Loading