-
Notifications
You must be signed in to change notification settings - Fork 56
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
Apollo Engine cacheControl directive not found in schema.graphql #153
Comments
That's a great point @loicplaire. I'm looping into @martijnwalraven who might have an idea for this. |
This seems like an issue specific to |
(So far) |
I'm having the same issue, no matter which way I attach my directives I continually get the same error. Super frustrating. |
Correct me if I am wrong but if |
Try this: directive @cacheControl(
maxAge: Int,
scope: CacheControlScope
) on OBJECT | FIELD_DEFINITION
enum CacheControlScope {
PUBLIC
PRIVATE
} |
Thanks a lot @Akryum, re-declaring the directive in my schema would work 👍. |
@loicplaire I agree. Something feels wrong about this approach, even tho it works. Perhaps it is a setback due to the way graphql-import was designed |
@netspencer during the time Would love to hear ideas about this! 💡 |
Hello! apollo engine returns the following: 'time = "2018-05-11T14: 11: 12-07: 00" level = debug msg = "QueryResponseCache not caching: Response overall cache maxAge is 0." cachePolicy = PUBLIC signature = "..." 'and I'm using the cacheControl directive in a type, do you know why it happens?
|
@Akryum I am getting this error - Error: There can be only one type named "CacheControlScope". Enum value "CacheControlScope.PUBLIC" can only be defined once. Enum value "CacheControlScope.PRIVATE" can only be defined once. When I added this code
|
The same error here |
Since 1.0.0 |
Just for future reference for people landing here when looking for This has been added to the Apollo docs:
enum CacheControlScope {
PUBLIC
PRIVATE
}
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
inheritMaxAge: Boolean
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION https://www.apollographql.com/docs/apollo-server/performance/caching/#in-your-schema-static |
FYI, I initially raised this issue on graphql-yoga.
I setup a repository with an example of the issue I am running into: https://github.com/loicplaire/graphql-yoga-engine-issue
When I use the
@cacheControl
directive in myschema.graphql
file, I get the following error:My assumption is that
graphql-import
only understands built-in directives or directives directly imported in theschema.graphql
file.In that case how would I import the
cacheControl
directive fromapollo-cache-control
in my.graphql
files when this doesn't seem to be exported by this package? Would I have to redeclare it?Thanks!
The text was updated successfully, but these errors were encountered: