Skip to content

Add example on how to use with faker (or equivalent) #41

@zhouzi

Description

@zhouzi

Using this package with faker to generate realistic mocks should be straightforward. But it's such a common use case that I think it would be great to add an example for it.

I have not tried it but it should boil down to:

  1. Use graphql-codegen's add plugin to prepend import { faker } from '@faker-js/faker'; to the generated files.
  2. Define the scalars' defaults to use faker:
    scalarDefaults:
      ID: faker.random.alphaNumeric(16)
      Email: faker.internet.email()

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationhelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions