Skip to content

Commit

Permalink
feat(api): set graphql depth and complexity limit for introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed Mar 10, 2024
1 parent ad2229a commit f6db33d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/synd_api/src/gql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ pub fn schema_builder() -> SchemaBuilder<Query, Mutation, EmptySubscription> {
let schema = Schema::build(Query, Mutation, EmptySubscription);

#[cfg(not(feature = "introspection"))]
let schema = schema.disable_introspection();
schema
.disable_introspection()
.limit_depth(10)
.limit_complexity(50);

#[cfg(feature = "introspection")]
schema.limit_depth(20).limit_complexity(300)

// disabled
// schema.extension(Tracing)
schema.limit_depth(10).limit_complexity(50)
}

impl<'a> usecase::Context for &async_graphql::Context<'a> {
Expand Down

0 comments on commit f6db33d

Please sign in to comment.