Skip to content

Commit

Permalink
fix: make unreliable AssetMapping fields optional (#1029)
Browse files Browse the repository at this point in the history
* fix: make fields with unreliable existence optional

* test: update test

---------

Co-authored-by: Fredrik Anfinsen <[email protected]>
  • Loading branch information
haakonflatval-cognite and BugGambit authored Sep 18, 2024
1 parent ba561d7 commit 5e97292
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/stable/src/__tests__/api/assetMappings3D.int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ describe.skip('AssetMappings3D integration test', () => {
});

test('filter with treeIndexes filter succeeds', async () => {
if (assetMapping.treeIndex === undefined) {
throw Error('Asset mapping tree index was undefined');
}

const response = await client.assetMappings3D.filter(
model.id,
revision.id,
Expand Down
6 changes: 4 additions & 2 deletions packages/stable/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,14 @@ export interface AssetMapping3D extends AssetMapping3DBase {
/**
* A number describing the position of this node in the 3D hierarchy, starting from 0.
* The tree is traversed in a depth-first order.
* Only present if the asset mapping's node ID is valid.
*/
treeIndex: number;
treeIndex?: number;
/**
* The number of nodes in the subtree of this node (this number included the node itself).
* Only present if the asset mapping's node ID is valid.
*/
subtreeSize: number;
subtreeSize?: number;
}

export interface AssetMapping3DBase {
Expand Down

0 comments on commit 5e97292

Please sign in to comment.