Open
Description
Describe the bug
When calling document.list()
and specifying instanceId
as a filter, a 500 error is returned.
To Reproduce
Execute the following code:
client.documents.list({
filter: {
equals: {
property: ["instanceId"],
value: {
externalId: "377471e4-c9cf-4a3b-9e35-49981c8b576a",
},
},
},
limit: 1000,
});
You will see an 500 error Internal server error. Please contact Cognite.
- The
DocumentFilterValue
follows theLabel
interface, which results in{externalId: "your externalId"}
based on its definition.
https://github.com/cognitedata/cognite-sdk-js/blob/c278e56ae3/packages/stable/src/api/documents/types.gen.ts#L317
Expected behavior
I was able to get a valid response with this request:
client.post(
`/api/v1/projects/${PROJECT}/documents/list`,
{
data: {
filter: {
equals: {
property: ["instanceId"],
value: {
space: "File_Search",
externalId: "377471e4-c9cf-4a3b-9e35-49981c8b576a",
},
},
},
limit: 1000,
},
}
);
In my humble opinion, we should create a new interface instead of Label
interface for example:
export type CogniteExternalId = string;
export type CogniteSpace = string;
export interface Instance {
externalId: CogniteExternalId;
space: CogniteSpace;
}
Metadata
Metadata
Assignees
Labels
No labels