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
134 stars 46 forks source link

Create a value based on the key name #153

Closed liorpevzner closed 4 months ago

liorpevzner commented 8 months ago

Hi got a question. Is it possible or maybe a future feature to add GeneratorOptions based on the key name? for example if I have an type type User { userId: String! }

when the mock will be generated for the User, userId will be mapped to a random string. Is it possible to check if the key has a certain regex inside of it and generate a faker based response? I understand that userId should be defined as an ID and that can solve my problems, buy maybe thats a useful feature anyway.

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ardeois commented 5 months ago

@liorpevzner sorry for the delay We already have fieldGeneration option already It doesn't accept regex but you can decide which faker generator to use for a specific field

Is this answering your question?