Open
Description
Which packages are impacted by your issue?
@graphql-codegen/visitor-plugin-common
Describe the bug
Using config for enums like:
enumValues: {
ReviewStatus: {
{
PREVIEW: 'preview',
FULL: 'full',
DISCARDED: 'discarded',
}
}
}
generates a resolver type for the enum of type null
. E.g.
// ...
export type ResolverTypes = {
// ...
ReviewStatus: null;
// ...
}
I suspect this commit is the culprit and that the logic should probably be something like
const isExternalFile = !!this.config.enumValues[typeName].sourceFile;
prev[typeName] = isExternalFile
? this.convertName(this.config.enumValues[typeName].typeIdentifier, {
useTypesPrefix: false,
useTypesSuffix: false,
})
: (this.config.enumValues[typeName].sourceIdentifier || this.convertName(this.config.enumValues[typeName].typeIdentifier));
Your Example Website or App
none
Steps to Reproduce the Bug or Issue
See description above
Expected behavior
The enum resolverType should be the enum, and not null.
Screenshots or Videos
No response
Platform
- OS: macOS
- NodeJS: 22
@graphql-codegen/visitor-plugin-common
version(s): 5.6.0
Codegen Config File
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels