Schema transformer fix#2078
Merged
Merged
Conversation
This was referenced Oct 20, 2020
Member
|
As discussed - let put an explicit .equals and hashCode in each SchemaElement such that they always called Object.equals We can put doco on the SchemaElement interface in why |
Member
Author
|
@bbakerman I added a javadoc on the |
… not be broken in the future
bbakerman
approved these changes
Oct 25, 2020
| * | ||
| * @return | ||
| */ | ||
| boolean equals(Object obj); |
Member
There was a problem hiding this comment.
Should also have hashCode() - HashSet relies on it not just equals
| Set<GraphQLSchemaElement> notPermMarked = new LinkedHashSet<>(allNodes); | ||
| Set<GraphQLSchemaElement> tempMarked = new LinkedHashSet<>(); | ||
| Set<GraphQLSchemaElement> permMarked = new LinkedHashSet<>(); | ||
| /** |
Member
There was a problem hiding this comment.
We really have entered DAG academia havent we. Glad we have you!
| permMarked.add(n); | ||
| notPermMarked.remove(n); | ||
| result.add(n); | ||
| } |
Member
There was a problem hiding this comment.
This feels like it could be a generic utility. A DagUtil kinda class
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.
This changes the Schema transformer implementation in order to overcome some limitations/fixes some bugs:
The main change is that the order of elements zipped up (moved up) is not depended on the depth (distance from dummy root), but the elements are sorted topologically (based on the reverse dependency of the normal graph).
It also changes the implementation of
GraphQLListandGraphQLNonNullto not implementequals/hashcodebecause when we treat theGraphQLSchemaas graph we rely fundamentally on the fact that every Node is unique and Nodes are equal only when it is the same instance.