@@ -22,6 +22,7 @@ any built in types (including Scalar and Introspection types).
22
22
All directives within a GraphQL schema must have unique names. A directive
23
23
and a type may share the same name, since there is no ambiguity between them.
24
24
25
+
25
26
## Types
26
27
27
28
The fundamental unit of any GraphQL Schema is the type. There are eight kinds
@@ -59,6 +60,7 @@ Finally, oftentimes it is useful to provide complex structs as inputs to
59
60
GraphQL queries; the ` Input Object ` type allows the schema to define exactly
60
61
what data is expected from the client in these queries.
61
62
63
+
62
64
### Scalars
63
65
64
66
As expected by the name, a scalar represents a primitive value in GraphQL.
@@ -113,13 +115,14 @@ and floating-point values, they are interpreted as an integer input value if
113
115
they have an empty fractional part (ex. ` 1.0 ` ) and otherwise as floating-point
114
116
input value.
115
117
116
- #### Built-in Scalars
118
+ ** Built-in Scalars**
117
119
118
120
GraphQL provides a basic set of well-defined Scalar types. A GraphQL server
119
121
should support all of these types, and a GraphQL server which provide a type by
120
122
these names must adhere to the behavior described below.
121
123
122
- ##### Int
124
+
125
+ #### Int
123
126
124
127
The Int scalar type represents a signed 32-bit numeric non-fractional values.
125
128
Response formats that support a 32-bit integer or a number type should use
@@ -143,7 +146,8 @@ Note: Numeric integer values larger than 32-bit should either use String or a
143
146
custom-defined Scalar type, as not all platforms and transports support
144
147
encoding integer numbers larger than 32-bit.
145
148
146
- ##### Float
149
+
150
+ #### Float
147
151
148
152
The Float scalar type represents signed double-precision fractional values
149
153
as specified by [ IEEE 754] ( http://en.wikipedia.org/wiki/IEEE_floating_point ) .
@@ -165,7 +169,8 @@ other input values, including strings with numeric content, must raise a query
165
169
error indicating an incorrect type. If the integer input value represents a
166
170
value not representable by IEEE 754, a query error should be raised.
167
171
168
- ##### String
172
+
173
+ #### String
169
174
170
175
The String scalar type represents textual data, represented as UTF-8 character
171
176
sequences. The String type is most often used by GraphQL to represent free-form
@@ -185,7 +190,8 @@ When expected as an input type, only valid UTF-8 string input values are
185
190
accepted. All other input values must raise a query error indicating an
186
191
incorrect type.
187
192
188
- ##### Boolean
193
+
194
+ #### Boolean
189
195
190
196
The Boolean scalar type represents ` true ` or ` false ` . Response formats should
191
197
use a built-in boolean type if supported; otherwise, they should use their
@@ -202,7 +208,8 @@ otherwise they must raise a field error. Examples of this may include returning
202
208
When expected as an input type, only boolean input values are accepted. All
203
209
other input values must raise a query error indicating an incorrect type.
204
210
205
- ##### ID
211
+
212
+ #### ID
206
213
207
214
The ID scalar type represents a unique identifier, often used to refetch an
208
215
object or as key for a cache. The ID type is serialized in the same way as
@@ -444,6 +451,7 @@ executor, so this is covered in that section of the spec.
444
451
445
452
Objects are never valid inputs.
446
453
454
+
447
455
#### Object Field Arguments
448
456
449
457
Object fields are conceptually functions which yield values. Occasionally object
@@ -484,13 +492,15 @@ May yield the result:
484
492
485
493
The type of an object field argument can be any Input type.
486
494
495
+
487
496
#### Object Field deprecation
488
497
489
498
Fields in an object may be marked as deprecated as deemed necessary by the
490
499
application. It is still legal to query for these fields (to ensure existing
491
500
clients are not broken by the change), but the fields should be appropriately
492
501
treated in documentation and tooling.
493
502
503
+
494
504
#### Object type validation
495
505
496
506
Object types have the potential to be invalid if incorrectly defined. This set
@@ -618,6 +628,7 @@ is the same as the result coercion of the object.
618
628
619
629
Interfaces are never valid inputs.
620
630
631
+
621
632
#### Interface type validation
622
633
623
634
Interface types have the potential to be invalid if incorrectly defined.
@@ -699,6 +710,7 @@ same as the result coercion of the object.
699
710
700
711
Unions are never valid inputs.
701
712
713
+
702
714
#### Union type validation
703
715
704
716
Union types have the potential to be invalid if incorrectly defined.
@@ -793,6 +805,7 @@ the only item in the list. This is to allow inputs that accept a "var args"
793
805
to declare their input type as a list; if only one argument is passed (a common
794
806
case), the client can just pass that value rather than constructing the list.
795
807
808
+
796
809
### Non-Null
797
810
798
811
By default, all types in GraphQL are nullable; the {null} value is a valid
@@ -858,6 +871,7 @@ engine supports.
858
871
859
872
GraphQL implementations should provide the ` @skip ` and ` @include ` directives.
860
873
874
+
861
875
### @skip
862
876
863
877
The ` @skip ` directive may be provided for fields, fragment spreads, and
@@ -873,6 +887,7 @@ query myQuery($someTest: Boolean) {
873
887
}
874
888
```
875
889
890
+
876
891
### @include
877
892
878
893
The ` @include ` directive may be provided for fields, fragment spreads, and
@@ -891,7 +906,7 @@ query myQuery($someTest: Boolean) {
891
906
In the case that both the ` @skip ` and ` @include ` directives are provided in the same context, the field or fragment * must* be queried only if the ` @skip ` condition is false * and* the ` @include ` condition is true. Stated conversely, the field/fragment must * not* be queried if either the ` @skip ` condition is true * or* the ` @include ` condition is false.
892
907
893
908
894
- ## Starting types
909
+ ## Initial types
895
910
896
911
A GraphQL schema includes types, indicating where query and mutation
897
912
operations start. This provides the initial entry points into the
0 commit comments