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