mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-11-04 09:57:41 +03:00 
			
		
		
		
	Merge pull request #623 from jkimbo/scalar-documentation
[Docs] Scalar documentation
This commit is contained in:
		
						commit
						5036d164b7
					
				| 
						 | 
					@ -1,20 +1,83 @@
 | 
				
			||||||
Scalars
 | 
					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 defines the following base Scalar Types:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- ``graphene.String``
 | 
					``graphene.String``
 | 
				
			||||||
- ``graphene.Int``
 | 
					
 | 
				
			||||||
- ``graphene.Float``
 | 
					    Represents textual data, represented as UTF-8
 | 
				
			||||||
- ``graphene.Boolean``
 | 
					    character sequences. The String type is most often used by GraphQL to
 | 
				
			||||||
- ``graphene.ID``
 | 
					    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 <http://en.wikipedia.org/wiki/IEEE_floating_point>`_.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``graphene.Float``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Represents signed double-precision fractional
 | 
				
			||||||
 | 
					    values as specified by
 | 
				
			||||||
 | 
					    `IEEE 754 <http://en.wikipedia.org/wiki/IEEE_floating_point>`_.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``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 also provides custom scalars for Dates, Times, and JSON:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- ``graphene.types.datetime.Date``
 | 
					``graphene.types.datetime.Date``
 | 
				
			||||||
- ``graphene.types.datetime.DateTime``
 | 
					
 | 
				
			||||||
- ``graphene.types.datetime.Time``
 | 
					    Represents a Date value as specified by `iso8601 <https://en.wikipedia.org/wiki/ISO_8601>`_.
 | 
				
			||||||
- ``graphene.types.json.JSONString``
 | 
					
 | 
				
			||||||
 | 
					``graphene.types.datetime.DateTime``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Represents a DateTime value as specified by `iso8601 <https://en.wikipedia.org/wiki/ISO_8601>`_.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``graphene.types.datetime.Time``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Represents a Time value as specified by `iso8601 <https://en.wikipedia.org/wiki/ISO_8601>`_.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``graphene.types.json.JSONString``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Represents a JSON string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Custom scalars
 | 
					Custom scalars
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user