Skip to content

Commit 5036d16

Browse files
authored
Merge pull request #623 from jkimbo/scalar-documentation
[Docs] Scalar documentation
2 parents 92f6a49 + 0a6921d commit 5036d16

File tree

1 file changed

+72
-9
lines changed

1 file changed

+72
-9
lines changed

docs/types/scalars.rst

+72-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,83 @@
11
Scalars
22
=======
33

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+
431
Graphene defines the following base Scalar Types:
532

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.
1163

1264
Graphene also provides custom scalars for Dates, Times, and JSON:
1365

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.
1881

1982

2083
Custom scalars

0 commit comments

Comments
 (0)