1 module graphql.schema.introspectiontypes;
2 
3 import std.meta : AliasSeq;
4 import std.typecons : Nullable;
5 
6 import nullablestore;
7 
8 import graphql.uda;
9 
10 alias IntrospectionTypes = AliasSeq!(__TypeKind, __DirectiveLocation,
11 		__Directive, __EnumValue, __InputValue, __Field, __Type, __Schema);
12 
13 struct __Schema {
14 	__Type[] types;
15 	__Type queryType;
16 	Nullable!__Type mutationType;
17 	Nullable!__Type subscriptionType;
18 	__Directive[] directives;
19 
20 	@GQLDUda(Ignore.yes)
21 	string toString() const {
22 		return "__Schema";
23 	}
24 }
25 
26 struct __Type {
27 	__TypeKind kind;
28 	Nullable!string name;
29 	Nullable!string description;
30 
31 	// OBJECT and INTERFACE only
32 	Nullable!(__Field[]) fields(bool includeDeprecated = false);
33 
34 	// OBJECT only
35 	Nullable!(__Type[]) interfaces;
36 
37 	// INTERFACE and UNION only
38 	Nullable!(__Type[]) possibleTypes;
39 
40 	// ENUM only
41 	Nullable!(__EnumValue[]) enumValues(bool includeDeprecated = false);
42 
43 	// INPUT_OBJECT only
44 	Nullable!(__InputValue[]) inputFields;
45 
46 	// NON_NULL and LIST only
47 	NullableStore!(__Type) ofType;
48 
49 	@GQLDUda(Ignore.yes)
50 	string toString() const {
51 		return "__Type";
52 	}
53 }
54 
55 struct __Field {
56 	string name;
57 	Nullable!string description;
58 	__InputValue[] args;
59 	__Type type;
60 	bool isDeprecated;
61 	Nullable!string deprecationReason;
62 
63 	@GQLDUda(Ignore.yes)
64 	string toString() const {
65 		return "__Field";
66 	}
67 }
68 
69 struct __InputValue {
70 	string name;
71 	Nullable!string description;
72 	NullableStore!__Type type; // TODO should not be NullableStore
73 	Nullable!string defaultValue;
74 
75 	@GQLDUda(Ignore.yes)
76 	string toString() const {
77 		return "__InputValue";
78 	}
79 }
80 
81 struct __EnumValue {
82 	string name;
83 	Nullable!string description;
84 	bool isDeprecated;
85 	Nullable!string deprecationReason;
86 
87 	@GQLDUda(Ignore.yes)
88 	string toString() const {
89 		return "__EnumValue";
90 	}
91 }
92 
93 enum __TypeKind {
94 	SCALAR,
95 	OBJECT,
96 	INTERFACE,
97 	UNION,
98 	ENUM,
99 	INPUT_OBJECT,
100 	LIST,
101 	NON_NULL
102 }
103 
104 struct __Directive {
105 	string name;
106 	Nullable!string description;
107 	__DirectiveLocation[] locations;
108 	__InputValue[] args;
109 
110 	@GQLDUda(Ignore.yes)
111 	string toString() const {
112 		return "__Directive";
113 	}
114 }
115 
116 enum __DirectiveLocation {
117 	QUERY,
118 	MUTATION,
119 	SUBSCRIPTION,
120 	FIELD,
121 	FRAGMENT_DEFINITION,
122 	FRAGMENT_SPREAD,
123 	INLINE_FRAGMENT,
124 	SCHEMA,
125 	SCALAR,
126 	OBJECT,
127 	FIELD_DEFINITION,
128 	ARGUMENT_DEFINITION,
129 	INTERFACE,
130 	UNION,
131 	ENUM,
132 	ENUM_VALUE,
133 	INPUT_OBJECT,
134 	INPUT_FIELD_DEFINITION
135 }