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:
- Use graphql-codegen's
add plugin to prepend import { faker } from '@faker-js/faker'; to the generated files.
- Define the scalars' defaults to use faker:
scalarDefaults:
ID: faker.random.alphaNumeric(16)
Email: faker.internet.email()
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:
addplugin to prependimport { faker } from '@faker-js/faker';to the generated files.