Skip to content

Allow to define random seed when generating scalar examples #998

@nitrotm

Description

@nitrotm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions