cosmo
cosmo copied to clipboard
`Required input field X cannot be deprecated` does not work when composition
Component(s)
composition
Component version
0.89.1
wgc version
0.53.2
controlplane version
router version
0.89.1
What happened?
Description
If you put the @deprecated directive on a mandatory field, cosmo builds the schema even though it shouldn't before the field is made optional (for schema compatibility)
apollo – GraphQLError: Required input field TestInput.testField cannot be deprecated. graphql-schema-linter – Required input field TestInput.testField cannot be deprecated. (invalid-graphql-schema) cosmo – OK, composite schema!
Steps to Reproduce
Initial scheme
input TestInput {
testField: String!
}
Set the directive and expect an error during composition
input TestInput {
testField: String! @deprecated
}
Cosmo doesn't cotton on to composition errors
Environment information
OS: 14.4 (23E214) Package Manager: npm Compiler(if manually compiled): go version go1.22.1 darwin/arm64
Router configuration
-
Router execution config
-
Log output
apollo:
GraphQLError: Required input field TestInput.testField cannot be deprecated.
at Object.err (/builds/node_modules/@apollo/federation-internals/dist/error.js:11:32)
at Validator.addError (/builds/node_modules/@apollo/federation-internals/dist/validate.js:100:57)
at Validator.validateInputObjectType (/builds/node_modules/@apollo/federation-internals/dist/validate.js:188:22)
at Validator.validate (/builds/node_modules/@apollo/federation-internals/dist/validate.js:64:26)
at validateSchema (/builds/node_modules/@apollo/federation-internals/dist/validate.js:11:34)
at Schema.validate (/builds/node_modules/@apollo/federation-internals/dist/definitions.js:1175:62)
at Subgraph.validate (/builds/node_modules/@apollo/federation-internals/dist/federation.js:1129:25)
at buildSubgraph (/builds/node_modules/@apollo/federation-internals/dist/federation.js:839:21)
at subgraphsFromServiceList (/builds/node_modules/@apollo/federation-internals/dist/federation.js:1004:27)
at Object.composeServices (/builds/node_modules/@apollo/composition/dist/compose.js:44:75) {
message: '[test-service] Required input field TestInput.testField cannot be deprecated.',
path: undefined,
locations: [ [Object], [Object] ],
extensions: { code: 'INVALID_GRAPHQL' }
}
graphql-schema-linter: Required input field TestInput.testField cannot be deprecated. (invalid-graphql-schema)
cosmo: OK, composite schema!
WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. The roadmap is driven by our customers and we have to prioritize issues that are important to them. You can influence the priority by becoming a customer. Please contact us here.
Hi @flymedllva,
This is a known issue with a ticket in our backlog. We'll address it in due course.
Thanks,
The WunderGraph Team