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
247247a given GraphQL server expects. Any other input value, including float input
248248values (such as ` 4.0 ` ), must raise a query error indicating an incorrect type.
249249
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.
250274
251275### Objects
252276
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ type __Type {
148148 # INPUT_OBJECT only
149149 inputFields: [__InputValue!]
150150
151- # NON_NULL and LIST only
151+ # SCALAR, NON_NULL and LIST only
152152 ofType: __Type
153153}
154154
@@ -223,7 +223,8 @@ actually valid. These kinds are listed in the `__TypeKind` enumeration.
223223
224224#### Scalar
225225
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.
227228
228229A GraphQL type designer should describe the data format and scalar coercion
229230rules in the description field of any scalar.
@@ -233,6 +234,7 @@ Fields
233234* ` kind ` must return ` __TypeKind.SCALAR ` .
234235* ` name ` must return a String.
235236* ` description ` may return a String or {null}.
237+ * ` ofType ` : must return a base scalar type if alias or {null}.
236238* All other fields must return {null}.
237239
238240
You can’t perform that action at this time.
0 commit comments