Caching schema to AST and restoring resolvers #1095
-
I'm trying to improve the time we spend on building the Schema - I have the usual things down - lazy loading, type loader, and all that jazz. I'm now attempting to incorporate saving the Schema as AST, loading it, and re-attaching the resolvers. I'm trying to do this following the issue here and the docs here. However. If there'a Query object defined like this: $query = new ObjectType([
'name' => 'Query',
'fields' => [
'foo' => [
'type' => Type::listOf(FooInterface::getType()),
'args' => FooArguments::getArguments(),
'resolve' => FooResolver::class . '::resolve',
'complexity' => FooComplexityFunction () {},
],
])
]); I'm having trouble reattaching this resolver. This is because Currently, it seems like the only way to do this would be to construct a If so, (and this is somewhat related, because it's annoying when people ask two things in one issue) - does this also imply that complexity values cannot be restored this way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you are defining your schema in code, there is no need to convert it to the AST representation of the SDL. That will not save time. |
Beta Was this translation helpful? Give feedback.
If you are defining your schema in code, there is no need to convert it to the AST representation of the SDL. That will not save time.