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

Scalar ID: not being possible to define custom generator #91

Closed cesarsalesgomes closed 1 year ago

cesarsalesgomes commented 1 year ago

Describe the Bug

Custom generator defined for Scalar ID seems to be always returning string type:

./cat/cat.mock.ts:
  schema: http://localhost/graphql
  documents:
    - ./cat/queries/*.graphql
  plugins:
    - typescript-mock-data:
        typesFile: "./cat.sdk.ts"
        scalars:
          ID:
            generator: integer
            arguments:
              - 1
              - 100

Generated mock

export const aCat = (overrides?: Partial<Cat>): Cat => {
  return {
    id:
      overrides && overrides.hasOwnProperty("id")
        ? overrides.id!
        : "f54c0ef5-82b1-4327-8142-8bf4cf1f3a2a",
  };
};

What version of graphql-codegen-typescript-mock-data are you using?

2.2.5

What version of Node.js are you using?

16.14.0

ardeois commented 1 year ago

Should be fixed in #95