1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
use bluejay_core::definition::{
EnumTypeDefinition, EnumValueDefinition, InputObjectTypeDefinition, InputValueDefinition,
};
use crate::{ExecutableEnum, ExecutableStruct};
pub trait CodeGenerator {
/// Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_executable_struct(
&self,
#[allow(unused_variables)] executable_struct: &ExecutableStruct,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Returns a syn::Fields struct that can be used to generate the fields of an executable struct.
fn fields_for_executable_struct(&self, executable_struct: &ExecutableStruct) -> syn::Fields;
/// Any additional impl blocks for the executable struct.
fn additional_impls_for_executable_struct(
&self,
#[allow(unused_variables)] executable_struct: &ExecutableStruct,
) -> Vec<syn::ItemImpl> {
Vec::new()
}
/// Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_executable_enum(
&self,
#[allow(unused_variables)] executable_enum: &ExecutableEnum,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any additional impl blocks for the executable enum.
fn additional_impls_for_executable_enum(
&self,
#[allow(unused_variables)] executable_enum: &ExecutableEnum,
) -> Vec<syn::ItemImpl> {
Vec::new()
}
/// Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_executable_enum_variant(
&self,
#[allow(unused_variables)] executable_struct: &ExecutableStruct,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any attributes for the `Other` variant that is added to all enums.
fn attributes_for_executable_enum_variant_other(&self) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any attributes for the enum type definition. Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_enum(
&self,
#[allow(unused_variables)] enum_type_definition: &impl EnumTypeDefinition,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any additional impl blocks for the enum type definition.
fn additional_impls_for_enum(
&self,
#[allow(unused_variables)] enum_type_definition: &impl EnumTypeDefinition,
) -> Vec<syn::ItemImpl> {
Vec::new()
}
/// Any attributes for the enum variant. Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_enum_variant(
&self,
#[allow(unused_variables)] enum_value_definition: &impl EnumValueDefinition,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any attributes for the `Other` variant that is added to all enums.
fn attributes_for_enum_variant_other(&self) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any attributes for the input object type definition. Does not need to include the doc string attribute, that will be added automatically.
/// Note that this does not apply to `@oneOf` input objects, those will use the `attributes_for_one_of_input_object` method instead.
fn attributes_for_input_object(
&self,
#[allow(unused_variables)] input_object_type_definition: &impl InputObjectTypeDefinition,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any additional impl blocks for the input object type definition.
/// Note that this does not apply to `@oneOf` input objects, those will use the `additional_impls_for_one_of_input_object` method instead.
fn additional_impls_for_input_object(
&self,
#[allow(unused_variables)] input_object_type_definition: &impl InputObjectTypeDefinition,
) -> Vec<syn::ItemImpl> {
Vec::new()
}
/// Any attributes for the input value definition. Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_input_object_field(
&self,
#[allow(unused_variables)] input_value_definition: &impl InputValueDefinition,
#[allow(unused_variables)] borrows: bool,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any attributes for the `@oneOf` input object type definition. Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_one_of_input_object(
&self,
#[allow(unused_variables)] input_object_type_definition: &impl InputObjectTypeDefinition,
) -> Vec<syn::Attribute> {
Vec::new()
}
/// Any additional impl blocks for the `@oneOf` input object type definition.
fn additional_impls_for_one_of_input_object(
&self,
#[allow(unused_variables)] input_object_type_definition: &impl InputObjectTypeDefinition,
) -> Vec<syn::ItemImpl> {
Vec::new()
}
/// Any attributes for the input value definition of a `@oneOf` input object. Does not need to include the doc string attribute, that will be added automatically.
fn attributes_for_one_of_input_object_field(
&self,
#[allow(unused_variables)] input_value_definition: &impl InputValueDefinition,
#[allow(unused_variables)] borrows: bool,
) -> Vec<syn::Attribute> {
Vec::new()
}
}