I have a code-generation file for my OGM that looks like this:
import * as path from "path";
import { generate } from "@neo4j/graphql-ogm";
import { OGM } from "@neo4j/graphql-ogm";
import driver from "./driver";
import fs from "fs";
import resolvers from "../resolvers";
const outFile = path.join(__dirname, "./ogm.types.ts");
const typeDefs = fs.readFileSync(
path.join(__dirname, "../graphql/typeDefs.graphql"),
"utf8"
);
const ogm = new OGM({ typeDefs, driver, resolvers });
ogm.init();
async function generateCode() {
await generate({
ogm,
outFile,
});
}
generateCode();
In this generator, I include the resolvers because I am using the @customResolver
directive, and I can not generate types without it.
However, I have accidentally added a misspelled key in my schema:
type Stub @exclude {
url: String!
title: String!
openId: String!
vies: [Vibe!]!
}
In order to remove this custom resolver item, I need to fix the typo and regenerate the types, however, I am unable to generate the code, because the linter complains I am missing the key of the misspelled item in the resolver:
Property 'vies' is missing in type '{ title: any; url: any; openId: any; vibes: any}' but required in type 'Stub'
So now I am deadlocked. Without editing a very large portion of my code to prevent the linting error, I am unable to generate the fix for the typo in my codebase.
Does anyone have a solution to a problem like this? This is not the first time I have encountered this circular dependency error.
"gen": "ts-node src/neo4j/generate.ts && graphql-codegen --config codegen.yml --debug"