Circular Dependency Error Neo4j-Graphql OGM Type Generator

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"

Hello! In this case, if you're absolutely certain that you're correct, you should be able to simply disable the linter/ts compiler.

If you want, you can create an example project for me to look at.

I think disabling the linter would be workable. Since I suppose I will only be doing it a single time to fix the typo, then go back to using the linter. Thanks for the tip.

Does this also include the case where I am using the OGM inside the resolvers? In this case, I have to add the resolver to the OGM initialization for the custom mapping, but the resolver also consumes the OGM. The error and solution would be the same, no?

I'm fairly sure it would be the same :slight_smile: