Closed Teddy-Wilson closed 3 months ago
Hi @Teddy-Wilson,
Thank you for the request 🙌 It's definitely something I will be looking to add this soon.
In the meantime, you can add external (or missing/custom) resolvers using externalResolvers config.
For example, if you have the following schema:
# src/schema/country/schema.graphql
enum Country {
US
UK
AU
}
Then, you can manually create the enum resolver:
// src/schema/country/resolvers/Country.ts
import type { CountryResolvers } from '../../types.generated';
export const Country: CountryResolvers = {
US: 'US',
UK: 'UK',
AU: 'AU'
};
And wire it up to resolvers.generated.ts
using this config:
// codegen.ts
defineConfig({
externalResolvers: {
Country: 'src/schema/country/resolvers/Country.ts'
}
})
Is your feature request related to a problem? Please describe. Unless I've missed it theres currently no way to generate resolvers for GraphQL enum types.
Describe the solution you'd like
resolverGeneration
objectDescribe alternatives you've considered None. But open to other alternatives if they exist.
Additional context N/A