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
@@ -223,7 +223,8 @@ actually valid. These kinds are listed in the `__TypeKind` enumeration.
223
223
224
224
#### Scalar
225
225
226
- Represents scalar types such as Int, String, and Boolean. Scalars cannot have fields.
226
+ Represents scalar types such as Int, String, and Boolean or scalar aliases.
227
+ Scalars cannot have fields.
227
228
228
229
A GraphQL type designer should describe the data format and scalar coercion
229
230
rules in the description field of any scalar.
@@ -233,6 +234,7 @@ Fields
233
234
* ` kind ` must return ` __TypeKind.SCALAR ` .
234
235
* ` name ` must return a String.
235
236
* ` description ` may return a String or {null}.
237
+ * ` ofType ` : must return a base scalar type if alias or {null}.
236
238
* All other fields must return {null}.
237
239
238
240
You can’t perform that action at this time.
0 commit comments