Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Improved conversion of ndb.KeyProperty to GraphQL #14

Merged
merged 14 commits into from
Jun 8, 2016

Conversation

ekampf
Copy link
Collaborator

@ekampf ekampf commented Jun 8, 2016

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
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@ekampf ekampf merged commit 521e1cc into master Jun 8, 2016
@ekampf ekampf deleted the feature/improved_key_property_behaviour branch June 8, 2016 16:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants