You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since @apollo/gateway version 0.6.12, when using the @provides-directive on an interface or an object type implementing an interface, the gateway throws an error.
Last working version: 0.6.11
Expected behavior: The @provides-directive should work on fields of interfaces and object types, as long as the type has a @key-directive.
Actual behavior: The gateway throws following errors:
// User is an interface
GraphQLSchemaValidationError: [products] Product.producer -> uses the @provides directive but Product.producer returns User!, which is not an Object type. @provides can only be used on Object types with at least one @key.
or
// Producer is an object type implementing User
GraphQLSchemaValidationError: [products] Product.producer -> uses the @provides directive but Product.producer returns Producer!, which is not an Object type. @provides can only be used on Object types with at least one @key.
The stacktrace is as follows:
atApolloGateway.createSchema(.../node_modules/@apollo/gateway/dist/index.js:92:19)atApolloGateway.<anonymous>(.../node_modules/@apollo/gateway/dist/index.js:81:22)atGenerator.next(<anonymous>)
at fulfilled (.../node_modules/@apollo/gateway/dist/index.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
You're right, these are indeed limitations of the current schema composition and query planning implementations: interfaces do not support @key directives, and you can't use @provides on fields that return an interface type. We definitely intend to support this in the future however.
You're right, these are indeed limitations of the current schema composition and query planning implementations: interfaces do not support @key directives, and you can't use @provides on fields that return an interface type. We definitely intend to support this in the future however.
Well, it worked on object-types that were implementing an interface (in 0.6.11 downwards) but stopped working since 0.6.12. What about that? Why did it work before?
Since @apollo/gateway version 0.6.12, when using the @provides-directive on an interface or an object type implementing an interface, the gateway throws an error.
Last working version: 0.6.11
Expected behavior: The @provides-directive should work on fields of interfaces and object types, as long as the type has a @key-directive.
Actual behavior: The gateway throws following errors:
// User is an interface
GraphQLSchemaValidationError: [products] Product.producer -> uses the @provides directive but
Product.producer
returnsUser!
, which is not an Object type. @provides can only be used on Object types with at least one @key.or
// Producer is an object type implementing User
GraphQLSchemaValidationError: [products] Product.producer -> uses the @provides directive but
Product.producer
returnsProducer!
, which is not an Object type. @provides can only be used on Object types with at least one @key.The stacktrace is as follows:
Reproduction: https://github.com/ddubbert/gateway-provides-issue
Short Type summary: The corresponding type definitions look like this (unnecessary fields were excluded):
The text was updated successfully, but these errors were encountered: