graphql_federated_graph/directives/
federation.rs

1use crate::{InterfaceId, ObjectId, OverrideLabel, OverrideSource, SelectionSet, StringId, SubgraphId, Type};
2
3///```ignore,graphql
4/// directive @join__type(
5///     graph: join__Graph!,
6///     key: join__FieldSet,
7///     extension: Boolean! = false,
8///     resolvable: Boolean! = true,
9///     isInterfaceObject: Boolean! = false
10/// ) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR
11///```
12#[derive(Clone, PartialEq, PartialOrd, Debug)]
13pub struct JoinTypeDirective {
14    pub subgraph_id: SubgraphId,
15    pub key: Option<SelectionSet>,
16    pub resolvable: bool,
17    pub is_interface_object: bool,
18}
19
20///```ignore,graphql
21/// directive @join__field(
22///     graph: join__Graph,
23///     requires: join__FieldSet,
24///     provides: join__FieldSet,
25///     type: String,
26///     external: Boolean,
27///     override: String,
28///     overrideLabel: String
29/// ) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
30/// ```
31#[derive(Default, Clone, PartialEq, PartialOrd, Debug)]
32pub struct JoinFieldDirective {
33    pub subgraph_id: Option<SubgraphId>,
34    pub requires: Option<SelectionSet>,
35    pub provides: Option<SelectionSet>,
36    pub r#type: Option<Type>,
37    pub external: bool,
38    pub r#override: Option<OverrideSource>,
39    pub override_label: Option<OverrideLabel>,
40}
41
42///```ignore,graphql
43/// directive @join__implements(
44///     graph: join__Graph!,
45///     interface: String!
46/// ) repeatable on OBJECT | INTERFACE
47/// ```
48#[derive(Clone, PartialEq, PartialOrd, Debug)]
49pub struct JoinImplementsDirective {
50    pub subgraph_id: SubgraphId,
51    pub interface_id: InterfaceId,
52}
53
54///```ignore,graphql
55/// directive @join__unionMember(
56///     graph: join__Graph!,
57///     member: String!
58/// ) repeatable on UNION
59///```
60#[derive(Clone, PartialEq, PartialOrd, Debug)]
61pub struct JoinUnionMemberDirective {
62    pub subgraph_id: SubgraphId,
63    pub object_id: ObjectId,
64}
65
66///```ignore,graphql
67/// directive @join__enumValue(
68///     graph: join__Graph!
69/// ) repeatable on ENUM_VALUE
70///```
71#[derive(Clone, PartialEq, PartialOrd, Debug)]
72pub struct JoinEnumValueDirective {
73    pub subgraph_id: SubgraphId,
74}
75
76/// ```ignore,graphql
77/// directive @join__graph(name: String!) on SCHEMA
78/// ```
79#[derive(Clone, PartialEq, PartialOrd, Debug)]
80pub struct JoinGraphDirective {
81    pub name: StringId,
82    pub url: Option<StringId>,
83}