Repository navigation
Reworks of relationship between Nodes/Objects, Connections and Edges - #288
Closed
Globegitter wants to merge 6 commits into
Closed
Globegitter wants to merge 6 commits into
Globegitter wants to merge 6 commits into
Conversation
…having complete custom edges.
Author
|
Ok, I am also seeing that |
Author
|
I now implemented what I proposed - removing the 'magic' auto generation of |
This was referenced Sep 26, 2016
Author
|
Can be closed in favour of #347 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…Edges.
I like a lot of the stuff that is happening on 1.0 :). After having looked more into how the relationship of connections to object types has been reworked I think there is a more accurate way of modeling their relationship.
To my understanding a
Nodeor anObjectTypecan belong to manyConnections. A Connection has only oneEdge(where-as anEdgecan belong to many Connection) and anEdgehas only oneNode/ObjectType(where-as again aNode/ObjectTypecan belong to manyEdges).This should allow for any of these use-cases by removing
NodeType.Connection, since it seems to me aNodeshould not now anything about aConnection. Furthermore this also leaves out a normalObjectType(which can be used for aConnection).Further I added a
Connection.for_type(GqlType)so we can get the automatically createdConnectionType. This uses a thread-safe caching library based on the python 3lru_cacheapi, I assume thememoizemight have been part of the multi-threading issues. If we don't want to use memoizing at all the only other ways I can see are:TypeMapObjectType/Nodeand then providing a function to retrieve this alaget_auto_generated_connection_from_type(GqlType, 'ConnectionName')but that kind of seems a bit sucky.ConnectionFieldwhich is responsible for auto-creating the connectionConnectionscompletely (i.e. disallowing creating aConnectionField with aNode/ObjectType) and just making it easy to create your ownConnectionby providingAbstractTypesand maybeConnection.for_typefunction that, which then creates the connection that is used for theConnectionField`Having thought about this a bit more, I am actually quite in favor of the last option, which would only require minor changes to this PR.
Anyway, I know this is a lot of text and not sure if that is all clear, but there should be tests for all changes, which might make it easier to understand. Let me know what you think @syrusakbary.
Btw, apart from the rework this also includes the fixes from #253 and allows for a resolver to return a
Connectiondirectly.