|
1 | 1 | Scalars
|
2 | 2 | =======
|
3 | 3 |
|
| 4 | +All Scalar types accept the following arguments. All are optional: |
| 5 | + |
| 6 | +``name``: *string* |
| 7 | + |
| 8 | + Override the name of the Field. |
| 9 | + |
| 10 | +``description``: *string* |
| 11 | + |
| 12 | + A description of the type to show in the GraphiQL browser. |
| 13 | + |
| 14 | +``required``: *boolean* |
| 15 | + |
| 16 | + If ``True``, the server will enforce a value for this field. See `NonNull <./list-and-nonnull.html#nonnull>`_. Default is ``False``. |
| 17 | + |
| 18 | +``deprecation_reason``: *string* |
| 19 | + |
| 20 | + Provide a deprecation reason for the Field. |
| 21 | + |
| 22 | +``default_value``: *any* |
| 23 | + |
| 24 | + Provide a default value for the Field. |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +Base scalars |
| 29 | +------------ |
| 30 | + |
4 | 31 | Graphene defines the following base Scalar Types:
|
5 | 32 |
|
6 |
| -- ``graphene.String`` |
7 |
| -- ``graphene.Int`` |
8 |
| -- ``graphene.Float`` |
9 |
| -- ``graphene.Boolean`` |
10 |
| -- ``graphene.ID`` |
| 33 | +``graphene.String`` |
| 34 | + |
| 35 | + Represents textual data, represented as UTF-8 |
| 36 | + character sequences. The String type is most often used by GraphQL to |
| 37 | + represent free-form human-readable text. |
| 38 | + |
| 39 | +``graphene.Int`` |
| 40 | + |
| 41 | + Represents non-fractional signed whole numeric |
| 42 | + values. Int can represent values between `-(2^53 - 1)` and `2^53 - 1` since |
| 43 | + represented in JSON as double-precision floating point numbers specified |
| 44 | + by `IEEE 754 <http://en.wikipedia.org/wiki/IEEE_floating_point>`_. |
| 45 | + |
| 46 | +``graphene.Float`` |
| 47 | + |
| 48 | + Represents signed double-precision fractional |
| 49 | + values as specified by |
| 50 | + `IEEE 754 <http://en.wikipedia.org/wiki/IEEE_floating_point>`_. |
| 51 | + |
| 52 | +``graphene.Boolean`` |
| 53 | + |
| 54 | + Represents `true` or `false`. |
| 55 | + |
| 56 | +``graphene.ID`` |
| 57 | + |
| 58 | + Represents a unique identifier, often used to |
| 59 | + refetch an object or as key for a cache. The ID type appears in a JSON |
| 60 | + response as a String; however, it is not intended to be human-readable. |
| 61 | + When expected as an input type, any string (such as `"4"`) or integer |
| 62 | + (such as `4`) input value will be accepted as an ID. |
11 | 63 |
|
12 | 64 | Graphene also provides custom scalars for Dates, Times, and JSON:
|
13 | 65 |
|
14 |
| -- ``graphene.types.datetime.Date`` |
15 |
| -- ``graphene.types.datetime.DateTime`` |
16 |
| -- ``graphene.types.datetime.Time`` |
17 |
| -- ``graphene.types.json.JSONString`` |
| 66 | +``graphene.types.datetime.Date`` |
| 67 | + |
| 68 | + Represents a Date value as specified by `iso8601 <https://en.wikipedia.org/wiki/ISO_8601>`_. |
| 69 | + |
| 70 | +``graphene.types.datetime.DateTime`` |
| 71 | + |
| 72 | + Represents a DateTime value as specified by `iso8601 <https://en.wikipedia.org/wiki/ISO_8601>`_. |
| 73 | + |
| 74 | +``graphene.types.datetime.Time`` |
| 75 | + |
| 76 | + Represents a Time value as specified by `iso8601 <https://en.wikipedia.org/wiki/ISO_8601>`_. |
| 77 | + |
| 78 | +``graphene.types.json.JSONString`` |
| 79 | + |
| 80 | + Represents a JSON string. |
18 | 81 |
|
19 | 82 |
|
20 | 83 | Custom scalars
|
|
0 commit comments