cynic icon indicating copy to clipboard operation
cynic copied to clipboard

Directive support

Open obmarg opened this issue 2 years ago • 1 comments

The various derives (and probably the generator) should support passing directives in.

We should probably also offer first class support for the skip & include directives.

obmarg avatar Apr 05 '23 14:04 obmarg

Need to think about how to support each of the locations for directives in executables:

Field & FragmentSpread Positions

Field position seems relatively easy, can take a similar approach to arguments:

#[derive(QueryFragment)]
struct Whatever {
   #[directive(skipIf: $someVariable)]
   field: String

   #[cynic(spread)]
   #[directive(whatever: $xyz)]
   other: SomeFragment
}

Variable Definition

Similar for variable definitions

#[derive(QueryVariables)]
struct MyVariables {
   #[directive(whatever: 123)]
   variable: String
}

Fragment Definition

We don't currently support fragment definitions but this will need thought through if we decide to

Query & Mutation & Subscription Position

TBC

Inline Fragment

TBC

obmarg avatar May 07 '23 18:05 obmarg