Skip to content

Commit

Permalink
Reapply "Merge branch 'batch-limit' of https://github.com/biothings/b…
Browse files Browse the repository at this point in the history
…te_trapi_query_graph_handler into dev"

This reverts commit cca40d0.
  • Loading branch information
tokebe committed Dec 13, 2023
1 parent 5393e86 commit ded459f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/query_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ export default class QueryGraph {
}
}

_validateBatchSize(queryGraph: TrapiQueryGraph): void {
Object.entries(queryGraph.nodes).forEach(([nodeID, node]) => {
if (node.ids.length > 150) {
throw new InvalidQueryGraphError(`Query node ${nodeID} exceeds batch size limit.`);
}
});
}

_validateDuplicateEdges(queryGraph: TrapiQueryGraph): void {
const edgeSet = new Set();
for (const edgeID in queryGraph.edges) {
Expand Down Expand Up @@ -182,6 +190,7 @@ export default class QueryGraph {
this._validateDuplicateEdges(queryGraph);
this._validateNodeProperties(queryGraph);
this._validateEdgeProperties(queryGraph);
this._validateBatchSize(queryGraph);
this._validateCycles(queryGraph);
this._validateNoDuplicateQualifierTypes(queryGraph);
}
Expand Down

0 comments on commit ded459f

Please sign in to comment.