graphql-python / graphene-gae

GraphQL Support for Google AppEngine [DEPRECATED - Looking for maintainers]
http://docs.graphene-python.org/projects/gae/en/latest/
BSD 3-Clause "New" or "Revised" License
117 stars 14 forks source link

Improved conversion of ndb.KeyProperty to GraphQL #14

Closed ekampf closed 8 years ago

ekampf commented 8 years ago

Basically we want to allow 2 ways of accessing a key's values.

  1. Access the key's actual value without querying NDB - we'll just use key.urlsafe()
  2. Resolve the key to an entity and query that entity - key.get()

We support 2 naming conventions:

_key or _keys Suffix

NDB Model has a property that looks like this: store_key = ndb.KeyProperty(...) In this case we'll convert it into the following 2 GraphQL fields:

store_key = graphene.String()  # resolves to entity.store_key.urlsafe()
store = NdbKeyField()  # resolves to entity entity.store_key.get()

Regular Name

NDB Model has a property that looks like this: store = ndb.KeyProperty(...) In this case we'll convert it into the following 2 GraphQL fields:

store_key = graphene.String() -> resolves to store_key.urlsafe()
store     = NdbKeyField()     -> resolves to entity
coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.1%) to 96.793% when pulling 27422a26ca7736a2c692271c8bfc3d3a918c16cc on feature/improved_key_property_behaviour into e75e1be6dbc099a3059d15a5c3c8aaaf5a3e86b3 on master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+2.2%) to 99.077% when pulling 0ff360c128858a6be6b80fc094d8a45fd9c11297 on feature/improved_key_property_behaviour into e75e1be6dbc099a3059d15a5c3c8aaaf5a3e86b3 on master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+2.5%) to 99.388% when pulling d4ba0b90237a49d1ac2a64fabc8b07737271fe33 on feature/improved_key_property_behaviour into e75e1be6dbc099a3059d15a5c3c8aaaf5a3e86b3 on master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+2.8%) to 99.694% when pulling 45f493bdb7c416289c35c2390a678b02761b9a14 on feature/improved_key_property_behaviour into e75e1be6dbc099a3059d15a5c3c8aaaf5a3e86b3 on master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+2.8%) to 99.694% when pulling a95d6f90b9a9a59a164faa0467db3f090ab77d94 on feature/improved_key_property_behaviour into e75e1be6dbc099a3059d15a5c3c8aaaf5a3e86b3 on master.