Open nitrotm opened 1 month ago
The code used to generate the sample values uses Math.random which cannot be initialized with a seed:
Math.random
https://github.com/anvilco/spectaql/blob/9f38a4ea1000d52b39d1dd4669c2c417be74ce1d/src/themes/default/helpers/graphql-scalars.js#L2
cf. https://github.com/Urigo/graphql-scalars/blob/master/src/mocks.ts
Would it be possible to copy this logic here to replace Math.random with something else, like:
https://github.com/michaeldzjap/rand-seed
and add a config option to initialize the seed to a fixed value and reset this on every query example maybe? That would be very helpful to generate static examples every time spectaql is executed.
The code used to generate the sample values uses
Math.random
which cannot be initialized with a seed:https://github.com/anvilco/spectaql/blob/9f38a4ea1000d52b39d1dd4669c2c417be74ce1d/src/themes/default/helpers/graphql-scalars.js#L2
cf. https://github.com/Urigo/graphql-scalars/blob/master/src/mocks.ts
Would it be possible to copy this logic here to replace
Math.random
with something else, like:https://github.com/michaeldzjap/rand-seed
and add a config option to initialize the seed to a fixed value and reset this on every query example maybe? That would be very helpful to generate static examples every time spectaql is executed.