andreas / ocaml-graphql-server

GraphQL servers in OCaml
MIT License
624 stars 60 forks source link

Fix skip/include directives on fragment spreads #200

Closed dwwoelfel closed 3 years ago

dwwoelfel commented 3 years ago

Quick patch for skip/include directives on fragment spreads.

The directives weren't being applied to the fragment spread because it was looking at the directives that were defined on the fragment definition (where skip and include aren't allowed).

In the example below, it was looking at (the made-up) fragmentDefDirective instead of the skip directive.

query TestQuery {
  test {
    ...TestFragment @skip(if: true)    
  }
}

fragment TestFragment on Test @fragmentDefDirective {
  id
}

Includes a test.

andreas commented 3 years ago

Thanks @dwwoelfel!