From 76f8a359164cbca2d9f4ce6506699cc84b0ff18e Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Sun, 10 Dec 2017 15:53:28 +0100 Subject: [PATCH 1/2] Add documentation for scalar type arguments --- docs/types/scalars.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/types/scalars.rst b/docs/types/scalars.rst index 0d979b5d..7ab1e73d 100644 --- a/docs/types/scalars.rst +++ b/docs/types/scalars.rst @@ -1,6 +1,33 @@ Scalars ======= +All Scalar types accept the following arguments. All are optional: + +``name``: *string* + + Override the name of the Field. + +``description``: *string* + + A description of the type to show in the GraphiQL browser. + +``required``: *boolean* + + If ``True``, the server will enforce a value for this field. See `NonNull <./list-and-nonnull.html#nonnull>`_. Default is ``False``. + +``deprecation_reason``: *string* + + Provide a deprecation reason for the Field. + +``default_value``: *any* + + Provide a default value for the Field. + + + +Base scalars +------------ + Graphene defines the following base Scalar Types: - ``graphene.String`` From 0a6921d2d048e17943e2d5ec3760e43d81b6145b Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Sun, 10 Dec 2017 16:07:48 +0100 Subject: [PATCH 2/2] Add extra documentation on base scalars --- docs/types/scalars.rst | 54 +++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/docs/types/scalars.rst b/docs/types/scalars.rst index 7ab1e73d..b6e8f654 100644 --- a/docs/types/scalars.rst +++ b/docs/types/scalars.rst @@ -30,18 +30,54 @@ Base scalars Graphene defines the following base Scalar Types: -- ``graphene.String`` -- ``graphene.Int`` -- ``graphene.Float`` -- ``graphene.Boolean`` -- ``graphene.ID`` +``graphene.String`` + + Represents textual data, represented as UTF-8 + character sequences. The String type is most often used by GraphQL to + represent free-form human-readable text. + +``graphene.Int`` + + Represents non-fractional signed whole numeric + values. Int can represent values between `-(2^53 - 1)` and `2^53 - 1` since + represented in JSON as double-precision floating point numbers specified + by `IEEE 754 `_. + +``graphene.Float`` + + Represents signed double-precision fractional + values as specified by + `IEEE 754 `_. + +``graphene.Boolean`` + + Represents `true` or `false`. + +``graphene.ID`` + + Represents a unique identifier, often used to + refetch an object or as key for a cache. The ID type appears in a JSON + response as a String; however, it is not intended to be human-readable. + When expected as an input type, any string (such as `"4"`) or integer + (such as `4`) input value will be accepted as an ID. Graphene also provides custom scalars for Dates, Times, and JSON: -- ``graphene.types.datetime.Date`` -- ``graphene.types.datetime.DateTime`` -- ``graphene.types.datetime.Time`` -- ``graphene.types.json.JSONString`` +``graphene.types.datetime.Date`` + + Represents a Date value as specified by `iso8601 `_. + +``graphene.types.datetime.DateTime`` + + Represents a DateTime value as specified by `iso8601 `_. + +``graphene.types.datetime.Time`` + + Represents a Time value as specified by `iso8601 `_. + +``graphene.types.json.JSONString`` + + Represents a JSON string. Custom scalars