Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to define random seed when generating scalar examples #998

Open
nitrotm opened this issue Sep 27, 2024 · 0 comments
Open

Allow to define random seed when generating scalar examples #998

nitrotm opened this issue Sep 27, 2024 · 0 comments

Comments

@nitrotm
Copy link

nitrotm commented Sep 27, 2024

The code used to generate the sample values uses Math.random which cannot be initialized with a seed:

import { mocks } from 'graphql-scalars'

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant