Describe the bug
Version >1.5.0 breaks flowtype resolvers. Downgrading to 1.5.0 fixes the issue.
To Reproduce
After upgrading to v1.7.0 and after regenerating the types, the flowtype resolvers reported 2 issues:

The ISubscriptionSubscribeResolveObject was introduce here #2346 but apparently the interface was not defined.
The Args was introduce here #2122 but flow reports that the type is not defined.
Am I missing some kind of extra configuration to make things work?
Expected behavior
The generated types should not report any flow errors.
@emmenko can you please share you configuration and your schema? It will make it easier to reproduce locally.
By the way, we've just added a cool service called The Connected Build. We can connect your build system and tests to the codegen's own CI. That way we'll find those things on the PR itself and make sure you are always up to date (https://the-guild.dev/connected-build). This could help up prevent more of those in the future (on top of our current tests)
can you please share you configuration and your schema? It will make it easier to reproduce locally.
Sure thing:
const gqlConfig = {
overwrite: true,
schema: `http://localhost:${port}/graphql`,
generates: {
'lib/types/generated/graphql-types.js': {
plugins: [`flow`],
},
'lib/types/generated/graphql-resolvers.js': {
plugins: [
{ add: "import type { GraphQLContext } from '../graphql';" },
`flow`,
`flow-resolvers`,
],
config: {
contextType: 'GraphQLContext',
skipTypename: true,
addUnderscoreToArgsType: true,
},
},
},
};
As for the schema, do you need the generated one or the original one? Asking 'cause the original one is spread across multiple files...
By the way, we've just added a cool service called The Connected Build.
Ah cool, didn't know about it. I'll check it out.
Thanks @emmenko ! I need the original schema, it doesn't have to be the complete schema that you are using, only the parts that causes the codegen to generate invalid output.
Ok, I'll try to narrow down the schema to a minimal reproduction case
So I was able to reproduce the problem with Args with a minimal schema. However, the ISubscriptionSubscribeResolveObject errors in both cases.
This causes the issue with Args
const crypto = require('crypto');
const { makeExecutableSchema } = require('graphql-tools');
const SchemaDefinition = `
type Query {
release: String
}
type Mutation {
random(byteLength: Int!): String!
}
schema {
query: Query
mutation: Mutation
}
`;
module.exports = makeExecutableSchema({
typeDefs: [SchemaDefinition],
resolvers: {
Query: {
release: () => '123',
},
Mutation: {
random: () => crypto.randomBytes(8).toString('hex'),
},
},
});
This works, no Args output
const crypto = require('crypto');
const { makeExecutableSchema } = require('graphql-tools');
const SchemaDefinition = `
type Query {
release: String
}
type Mutation {
random(byteLength: Int): String!
}
schema {
query: Query
mutation: Mutation
}
`;
module.exports = makeExecutableSchema({
typeDefs: [SchemaDefinition],
resolvers: {
Query: {
release: () => '123',
},
Mutation: {
random: () => crypto.randomBytes(8).toString('hex'),
},
},
});
The difference is in the mutation argument being optional or required.

Thank you @emmenko !
I think I managed to reproduce and fix it in: https://github.com/dotansimha/graphql-code-generator/pull/2533
Can you please try the lates alpha? 1.7.1-alpha-f7b843df.34
Yep, works now. Thanks! 馃挴
Fixed in 1.8.0 馃殌