Conversation
| it("Executing mutation without type definitions and/or resolver should throw", async () => { | ||
| const schemaFragment = { | ||
| schemaId: "test", | ||
| definitions: { types: {} }, | ||
| resolvers: {}, | ||
| }; |
There was a problem hiding this comment.
Add a separate test case where definitions are defined, but resolvers are not. We also want to throw in this case, right? E.g. minimal schema is passed, but resolvers are lost somewhere.
There was a problem hiding this comment.
Well, schema parts are coupled with corresponding resolvers so with full setup enabled it's usually both that are missing. But you're right, it's better to address it in a more robust manner.
| const isRootField = | ||
| parentTypeName === "Mutation" || parentTypeName === "Query"; | ||
| const unknownFieldErrorMessage = `${parentTypeName}.${fieldName} is not defined`; |
There was a problem hiding this comment.
This should be probably handled inside resolveAndCompleteField instead. The test I requested will likely pass without an error with current implementation.
There was a problem hiding this comment.
this part specifically doesn't fit into resolveAndCompleteField since we don't even enter there when there's no type definition.
84c3974 to
d8db64e
Compare
Introduces a change that makes execution throw if you try to run a query/mutation without definition.