Skip to content

Commit

Permalink
Added descriptions #2
Browse files Browse the repository at this point in the history
  • Loading branch information
mongkok committed Apr 12, 2018
1 parent c51c90d commit 3bb2039
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions graphql_geojson/types/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ class Distance(graphene.InputObjectType):
unit = DistanceUnitEnum(required=True)
value = graphene.Float(required=True)
geometry = Geometry(required=True)

class Meta:
description = """
Distance object type comprising:
- The desired `unit` attribute name
- Distance `value`
- A `geometry` to base calculations from
"""
13 changes: 13 additions & 0 deletions graphql_geojson/types/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

class Geometry(graphene.Scalar):

class Meta:
description = """
`Geometry` scalar may be represented in a few ways:
- Well-known text (WKT)
- Hexadecimal (HEX)
- GeoJSON
"""

@classmethod
def serialize(cls, value):
return json.loads(value.geojson)
Expand All @@ -39,3 +47,8 @@ class GeometryObjectType(graphene.ObjectType):

class Meta:
default_resolver = resolver.geometry_resolver
description = """
`GeometryObjectType` represents a pair of values:
- Geometry `type`
- Geometry `coordinates`
"""

0 comments on commit 3bb2039

Please sign in to comment.