ardeois / graphql-codegen-typescript-mock-data

[GraphQL Codegen Plugin](https://github.com/dotansimha/graphql-code-generator) for building mock data based on the schema.
MIT License
132 stars 47 forks source link

RangeError: Maximum call stack size exceeded #156

Open davidgtu opened 2 months ago

davidgtu commented 2 months ago

Hi there,

I was able to use this plugin to successfully generate mocked data, however whenever I try to use it in a test (or normally call it at all), I get an error:

RangeError: Maximum call stack size exceeded
 ❯ aMember src/generated/generated-mocks.ts:7690:3
    7688| 
    7689| export const aMember = (overrides?: Partial<Member>): Member => {
    7690|   return {
       |   ^
    7691|     data:
    7692|       overrides && overrides.hasOwnProperty('data......

I'm using vitest as a test runner, and when I simply do something like console.log(aMember({ firstName: 'test' }));, I still get this error.

Am I using this in the wrong way? I've tried using it in a test and I still get the same error.

Any help would be great. Thank you.

ardeois commented 2 months ago

This can happen if you have a Type with properties or sub-properties referencing the same type

You can use the option terminateCircularRelationships