Skip to content

Commit

Permalink
refactor(api): use cfg macro to configure gql schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed Mar 10, 2024
1 parent f6db33d commit d2a1f55
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions crates/synd_api/src/gql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ pub mod handler {
pub fn schema_builder() -> SchemaBuilder<Query, Mutation, EmptySubscription> {
let schema = Schema::build(Query, Mutation, EmptySubscription);

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

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

if cfg!(not(feature = "introspection")) {
schema
.disable_introspection()
.limit_depth(10)
.limit_complexity(50)
} else {
schema.limit_depth(20).limit_complexity(300)
}
// disabled
// schema.extension(Tracing)
}
Expand Down

0 comments on commit d2a1f55

Please sign in to comment.