Skip to content

Commit

Permalink
free inspection only for __schema and __type
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Jun 23, 2022
1 parent d37da40 commit c7dbac4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apollo-router/src/spec/query.rs
Expand Up @@ -727,7 +727,12 @@ impl Operation {

fn is_introspection(&self) -> bool {
self.selection_set.iter().all(|sel| match sel {
Selection::Field { name, .. } => name.as_str().starts_with("__"),
Selection::Field { name, .. } => {
let name = name.as_str();
// `__typename` can only be resolved in runtime,
// so this query cannot be seen as an introspection query
name == "__schema" || name == "__type"
}
_ => false,
})
}
Expand Down

0 comments on commit c7dbac4

Please sign in to comment.