File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,30 @@ as `4`) input value should be coerced to ID as appropriate for the ID formats
247
247
a given GraphQL server expects. Any other input value, including float input
248
248
values (such as ` 4.0 ` ), must raise a query error indicating an incorrect type.
249
249
250
+ ### Scalar aliases
251
+
252
+ Scalar aliases should be used to add specific semantic or validation on top
253
+ of the existing scalar type.
254
+
255
+ Note: only scalar types can be aliassed, not other aliases.
256
+
257
+ For example, a type ` DateTime ` could be described as:
258
+
259
+ ```
260
+ scalar alias DateTime = String
261
+ ```
262
+
263
+ Where ` DateTime ` is the name of alias and ` String ` is the name of the base scalar type.
264
+
265
+ ** Result Coercion**
266
+
267
+ Coertion of the scalar alias value should include coertion of base type as the
268
+ last step.
269
+
270
+ ** Input Coercion**
271
+
272
+ Coertion of the scalar alias value should include coertion of base type as the
273
+ first step.
250
274
251
275
### Objects
252
276
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ type __Type {
148
148
# INPUT_OBJECT only
149
149
inputFields: [__InputValue!]
150
150
151
- # NON_NULL and LIST only
151
+ # SCALAR, NON_NULL and LIST only
152
152
ofType: __Type
153
153
}
154
154
@@ -234,7 +234,8 @@ actually valid. These kinds are listed in the `__TypeKind` enumeration.
234
234
235
235
#### Scalar
236
236
237
- Represents scalar types such as Int, String, and Boolean. Scalars cannot have fields.
237
+ Represents scalar types such as Int, String, and Boolean or scalar aliases.
238
+ Scalars cannot have fields.
238
239
239
240
A GraphQL type designer should describe the data format and scalar coercion
240
241
rules in the description field of any scalar.
@@ -244,6 +245,7 @@ Fields
244
245
* ` kind ` must return ` __TypeKind.SCALAR ` .
245
246
* ` name ` must return a String.
246
247
* ` description ` may return a String or {null}.
248
+ * ` ofType ` : must return a base scalar type if alias or {null}.
247
249
* All other fields must return {null}.
248
250
249
251
You can’t perform that action at this time.
0 commit comments