1
1
# Type System
2
2
3
- The GraphQL Type system describes the capabilities of a GraphQL server and is
3
+ The GraphQL Type system describes the capabilities of a GraphQL service and is
4
4
used to determine if a query is valid. The type system also describes the
5
5
input types of query variables to determine if values provided at runtime
6
6
are valid.
@@ -346,7 +346,7 @@ promises to conform to ISO-8601. When querying a field of type `Time`, you can
346
346
then rely on the ability to parse the result with an ISO-8601 parser and use a
347
347
client-specific primitive for time. Another example of a potentially useful
348
348
custom scalar is ` Url ` , which serializes as a string, but is guaranteed by
349
- the server to be a valid URL.
349
+ the service to be a valid URL.
350
350
351
351
``` graphql example
352
352
scalar Time
@@ -373,7 +373,7 @@ all built-in scalars must be omitted for brevity.
373
373
374
374
** Result Coercion and Serialization**
375
375
376
- A GraphQL server , when preparing a field of a given scalar type, must uphold the
376
+ A GraphQL service , when preparing a field of a given scalar type, must uphold the
377
377
contract the scalar type describes, either by coercing the value or producing a
378
378
field error if a value cannot be coerced or if coercion may result in data loss.
379
379
@@ -383,21 +383,21 @@ expected return type. For example when coercing a field of type {Int} a boolean
383
383
{123}. However if internal type coercion cannot be reasonably performed without
384
384
losing information, then it must raise a field error.
385
385
386
- Since this coercion behavior is not observable to clients of the GraphQL server ,
386
+ Since this coercion behavior is not observable to clients of the GraphQL service ,
387
387
the precise rules of coercion are left to the implementation. The only
388
- requirement is that the server must yield values which adhere to the expected
388
+ requirement is that the service must yield values which adhere to the expected
389
389
Scalar type.
390
390
391
391
GraphQL scalars are serialized according to the serialization format being used.
392
392
There may be a most appropriate serialized primitive for each given scalar type,
393
- and the server should produce each primitive where appropriate.
393
+ and the service should produce each primitive where appropriate.
394
394
395
395
See [ Serialization Format] ( #sec-Serialization-Format ) for more detailed
396
396
information on the serialization of scalars in common JSON and other formats.
397
397
398
398
** Input Coercion**
399
399
400
- If a GraphQL server expects a scalar type as input to an argument, coercion
400
+ If a GraphQL service expects a scalar type as input to an argument, coercion
401
401
is observable and the rules must be well defined. If an input value does not
402
402
match a coercion rule, a query error must be raised.
403
403
@@ -425,7 +425,7 @@ that type to represent this scalar.
425
425
Fields returning the type {Int} expect to encounter 32-bit integer
426
426
internal values.
427
427
428
- GraphQL servers may coerce non-integer internal values to integers when
428
+ GraphQL services may coerce non-integer internal values to integers when
429
429
reasonable without losing information, otherwise they must raise a field error.
430
430
Examples of this may include returning ` 1 ` for the floating-point number ` 1.0 ` ,
431
431
or returning ` 123 ` for the string ` "123" ` . In scenarios where coercion may lose
@@ -460,7 +460,7 @@ should use that type to represent this scalar.
460
460
Fields returning the type {Float} expect to encounter double-precision
461
461
floating-point internal values.
462
462
463
- GraphQL servers may coerce non-floating-point internal values to {Float} when
463
+ GraphQL services may coerce non-floating-point internal values to {Float} when
464
464
reasonable without losing information, otherwise they must raise a field error.
465
465
Examples of this may include returning ` 1.0 ` for the integer number ` 1 ` , or
466
466
` 123.0 ` for the string ` "123" ` .
@@ -486,7 +486,7 @@ and that representation must be used here.
486
486
487
487
Fields returning the type {String} expect to encounter UTF-8 string internal values.
488
488
489
- GraphQL servers may coerce non-string raw values to {String} when reasonable
489
+ GraphQL services may coerce non-string raw values to {String} when reasonable
490
490
without losing information, otherwise they must raise a field error. Examples of
491
491
this may include returning the string ` "true" ` for a boolean true value, or the
492
492
string ` "1" ` for the integer ` 1 ` .
@@ -508,7 +508,7 @@ representation of the integers `1` and `0`.
508
508
509
509
Fields returning the type {Boolean} expect to encounter boolean internal values.
510
510
511
- GraphQL servers may coerce non-boolean raw values to {Boolean} when reasonable
511
+ GraphQL services may coerce non-boolean raw values to {Boolean} when reasonable
512
512
without losing information, otherwise they must raise a field error. Examples of
513
513
this may include returning ` true ` for non-zero numbers.
514
514
@@ -532,14 +532,14 @@ across many formats ID could represent, from small auto-increment numbers, to
532
532
large 128-bit random numbers, to base64 encoded values, or string values of a
533
533
format like [ GUID] ( https://en.wikipedia.org/wiki/Globally_unique_identifier ) .
534
534
535
- GraphQL servers should coerce as appropriate given the ID formats they expect.
535
+ GraphQL services should coerce as appropriate given the ID formats they expect.
536
536
When coercion is not possible they must raise a field error.
537
537
538
538
** Input Coercion**
539
539
540
540
When expected as an input type, any string (such as ` "4" ` ) or integer (such as
541
541
` 4 ` or ` -4 ` ) input value should be coerced to ID as appropriate for the ID
542
- formats a given GraphQL server expects. Any other input value, including float
542
+ formats a given GraphQL service expects. Any other input value, including float
543
543
input values (such as ` 4.0 ` ), must raise a query error indicating an incorrect
544
544
type.
545
545
@@ -1376,7 +1376,7 @@ enum Direction {
1376
1376
1377
1377
** Result Coercion**
1378
1378
1379
- GraphQL servers must return one of the defined set of possible values. If a
1379
+ GraphQL services must return one of the defined set of possible values. If a
1380
1380
reasonable coercion is not possible they must raise a field error.
1381
1381
1382
1382
** Input Coercion**
@@ -1562,7 +1562,7 @@ like this: `pets: [Pet]`. Nesting lists is allowed: `matrix: [[Int]]`.
1562
1562
1563
1563
**Result Coercion **
1564
1564
1565
- GraphQL servers must return an ordered list as the result of a list type . Each
1565
+ GraphQL services must return an ordered list as the result of a list type . Each
1566
1566
item in the list must be the result of a result coercion of the item type . If a
1567
1567
reasonable coercion is not possible it must raise a field error . In
1568
1568
particular , if a non -list is returned , the coercion should fail , as this
0 commit comments