-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Initial work on Traversal Improvements in GraphqlSchema builds #2463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| import static graphql.util.TraversalControl.CONTINUE; | ||
|
|
||
| /** | ||
| * This ensure that all fields have data fetchers and that unions and interfaces have type resolvers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this to a schem.impl package just to clean things up. Its kinda of a private thing and not general purpose
| @@ -1,12 +1,26 @@ | |||
| package graphql.schema; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again I moved this to a schem.impl package just to clean things up. Its kinda of a private thing and not general purpose
|
|
||
| import java.util.List; | ||
|
|
||
| public class MultiReadOnlyGraphQLTypeVisitor implements GraphQLTypeVisitor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows us to call N visitors at once - read only ones that can change nodes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that public api?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not so sure about the semantics here: they don't compose completely, right? I can't return a ABORT/Quit anymore, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They dont compose generically - they run one after the other. I have made it @Internal and improved the javadoc on what it does
| @@ -1,11 +1,24 @@ | |||
| package graphql.schema; | |||
| package graphql.schema.impl; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again again I moved this to a schem.impl package just to clean things up. Its kinda of a private thing and not general purpose
| @@ -1,7 +1,9 @@ | |||
| package graphql.schema; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again again again I moved this to a schem.impl package just to clean things up. Its kinda of a private thing and not general purpose
…uring_schema_build # Conflicts: # src/test/java/benchmark/SchemaBenchMark.java
…uring_schema_build
|
|
||
| final GraphQLSchema finalSchema = new GraphQLSchema(partiallyBuiltSchema, codeRegistry, allTypes, interfaceNameToObjectTypes); | ||
| schemaUtil.replaceTypeReferences(finalSchema); | ||
| if (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't look right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah as discussed direct - this was to show the new code versus the old.
The PR now has this removed and cleaned up
| */ | ||
| @Internal | ||
| public GraphQLSchema(GraphQLSchema partiallyBuiltSchema, | ||
| GraphQLCodeRegistry codeRegistry, ImmutableMap<String, GraphQLNamedType> typeMap, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be one line per arg, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
| import java.util.List; | ||
|
|
||
| public class MultiReadOnlyGraphQLTypeVisitor implements GraphQLTypeVisitor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that public api?
|
|
||
| import java.util.List; | ||
|
|
||
| public class MultiReadOnlyGraphQLTypeVisitor implements GraphQLTypeVisitor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not so sure about the semantics here: they don't compose completely, right? I can't return a ABORT/Quit anymore, for example.
…uring_schema_build # Conflicts: # src/main/java/graphql/schema/SchemaTransformer.java
| } | ||
|
|
||
| public static void replaceTypeReferences(GraphQLSchema schema) { | ||
| final Map<String, GraphQLNamedType> typeMap = schema.getTypeMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this code: it looks suspicious that we grab all types to iterate. I think we can do better and maybe this is not even completely correct. But we can leave it for another PR.
This is a WORK implementation of building a GraQhlSchema object with only less traversal
At this stage I left the OLD code in there so you could see what's different
It would be cleaned up if we accepted this code.
I copied the bench mark from the previous PR and run it.
It shows that this code as is BETTER - but not ground breakingly better.
Start
This work as is
I then took out the validation steps just to see what would happen to the numbers.
I then took out the type replacement step and validation just to see. This is not valid of course
Having the ability to skip validation would help. Type replacements MUST happen.
If we could find a way to combine type replacement with the previous steps then it would be better. But that might
be impossible - we need ALL the types collected to do type ref replacements... OR do we. ??? Anyway that's for another PR based on this one