Skip to content

Commit

Permalink
docs: update query fragment docs for directive support
Browse files Browse the repository at this point in the history
  • Loading branch information
obmarg committed Dec 31, 2024
1 parent 49d41d5 commit 61cae06
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cynic-book/src/derives/query-fragments.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,26 @@ This `operation` can then be used in exactly the same way as with queries.

<!-- TODO: An example of doing mutations -->

### Directives

Directives can be provided using the `directive` attribute:

```
#[cynic(
graphql_type = "Root",
variables = "FilmQueryVariables"
)]
struct FilmQuery {
#[arguments(id: $id)]
#[directives(skip(if: $should_skip))]
film: Option<Film>,
}
```

Cynic provides build in support for the `skip` & `include` directives. Any
other field directives can also be used, provided they don't require special
support from the client.

#### Struct Attributes

A QueryFragment can be configured with several attributes on the struct itself:
Expand Down

0 comments on commit 61cae06

Please sign in to comment.