Closed marceloverdijk closed 5 months ago
Maybe this is related to https://github.com/eddeee888/graphql-code-generator-plugins/pull/242 ? Are you planning a new release soon?
Hi @marceloverdijk ! Yes, I'm going to release a new patch soon. Apologies, I missed your issue in the last few weeks 🙏
Could you try this alpha version to see if it fixes your issue please?
yarn add -ED @eddeee888/gcg-typescript-resolver-files@pr242-run423-1
No worries. Not sure if I can test it the coming days, but looking forward to the new release anyway.
@eddeee888 I did a quick test with @eddeee888/gcg-typescript-resolver-files@pr242-run423-1
but I get the same result unfortunately:
@@ -1,8 +1,8 @@
import type { CountryResolvers } from './types.generated';
export const Country: CountryResolvers = {
/* Implement Country resolver logic here */
- code: () => { /* Country.code resolver is required because Country.code exists but CountryMapper.code does not */ },
- continent: () => { /* Country.continent resolver is required because Country.continent exists but CountryMapper.continent does not */ },
- id: () => { /* Country.id resolver is required because Country.id exists but CountryMapper.id does not */ },
- name: () => { /* Country.name resolver is required because Country.name exists but CountryMapper.name does not */ }
+ code: async (_parent, _arg, _ctx) => { /* Country.code resolver is required because Country.code exists but CountryMapper.code does not */ },
+ continent: async (_parent, _arg, _ctx) => { /* Country.continent resolver is required because Country.continent exists but CountryMapper.continent does not */ },
+ id: async (_parent, _arg, _ctx) => { /* Country.id resolver is required because Country.id exists but CountryMapper.id does not */ },
+ name: async (_parent, _arg, _ctx) => { /* Country.name resolver is required because Country.name exists but CountryMapper.name does not */ }
};
Note the async
part was added which is I assume another update in the alpha version.
Ah I see, thanks for trying it! I will take a look deeper into your issue tonight 👀
Hi @marceloverdijk,
I've got a PR ready: https://github.com/eddeee888/graphql-code-generator-plugins/pull/248
Could you try this alpha version please:
yarn add -DE @eddeee888/gcg-typescript-resolver-files@pr248-run448-1
Hi @eddeee888 yes that solves it 🥳
The resolver is now genereated as expected:
import type { CountryResolvers } from './types.generated';
export const Country: CountryResolvers = {
/* Implement Country resolver logic here */
code: async (_parent, _arg, _ctx) => {
/* Country.code resolver is required because Country.code exists but CountryMapper.code does not */
},
continent: async (_parent, _arg, _ctx) => {
/* Country.continent resolver is required because Country.continent exists but CountryMapper.continent does not */
},
};
Thx a lot!
Sample repo with the reproducible issue can be found here
Config:
schema.graphql:
schema.mappers.ts:
Drizzle schema.ts:
Generated Continent.ts:
This is as expected, as indeed the
ContinentMapper.name
does not exist.Generated Country.ts:
ISSUE:
id
andname
are part of thedrizzle/schema#Country
type, which is exported in schema.mappers.ts asCountryMapper
, yet the generatedCountryResolvers
is not regnosing them, and generated a unwanted resolvers for them.Note that in types.generated.ts the
CountryMapper
is imported, so at least it seems to have picked up that mapper: