@hegeldev/hegel
    Preparing search index...

    Class BasicGenerator<T>

    Schema-based generator descriptor. Holds a schema and an optional parse callback that transforms the raw server response into a value of type T.

    Other generators produce a BasicGenerator from asBasic() when they can be expressed as a single schema, letting parent generators (oneOf, arrays, ...) compose a unified schema rather than falling back to span-based draws.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Type Parameters

      • T

      Parameters

      • schema: Record<string, unknown>
      • Optionalparse: (raw: unknown) => T

      Returns BasicGenerator<T>

    Properties

    schema: Record<string, unknown>

    Methods

    • Only keep values that satisfy the predicate. Retries up to 3 times, then rejects the test case.

      Parameters

      • predicate: (value: T) => boolean

      Returns Generator<T>

    • Transform generated values using a function. When the source has a schema, the schema is preserved.

      Type Parameters

      • U

      Parameters

      • f: (value: T) => U

      Returns Generator<U>

    • Parameters

      • raw: unknown

      Returns T