Skip to content

Commit

Permalink
graph: Validate if pruning is decalred for source subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
incrypto32 committed Jan 28, 2025
1 parent 2dbe416 commit b98760f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion graph/src/data/subgraph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ pub struct BaseSubgraphManifest<C, S, D, T> {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IndexerHints {
prune: Option<Prune>,
pub prune: Option<Prune>,
}

impl IndexerHints {
Expand Down
11 changes: 11 additions & 0 deletions graph/src/data_source/subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,17 @@ impl UnresolvedDataSource {
));
}

let pruning_enabled = match source_manifest.indexer_hints.as_ref() {
None => false,
Some(hints) => hints.prune.is_some(),
};

if pruning_enabled {
return Err(anyhow!(
"Pruning is enabled for source subgraph, which is not supported"
));
}

let mapping_entities: Vec<String> = self
.mapping
.handlers
Expand Down

0 comments on commit b98760f

Please sign in to comment.