Some apps use custom scalar for date-related stuff. This caused issues with the way graphql-codegen-typescript-mock-data handles autogenerated data, since a "random string" (the current default), may not always be what you need.
This PR allows you to define mapping from your custom scalars to a casual embedded generator, allowing you to specify exactly how your scalar's autogenerated value will be populated
Closes #20
Caveats
To make configuration simple, a few "shortcuts" were taken. Namely:
the mapping only accepts a casual key (function or string) as a valid autogenerated value in order to align with the rest of the library
if a function is passed, then it will be called with its default arguments, since providing custom parameters for a function through a YAML file, would complicate things more than normal
Background
Some apps use custom scalar for date-related stuff. This caused issues with the way
graphql-codegen-typescript-mock-data
handles autogenerated data, since a "random string" (the current default), may not always be what you need.This PR allows you to define mapping from your custom scalars to a casual embedded generator, allowing you to specify exactly how your scalar's autogenerated value will be populated
Closes #20
Caveats
To make configuration simple, a few "shortcuts" were taken. Namely:
casual
key (function or string) as a valid autogenerated value in order to align with the rest of the library