@traversable/schema
    Preparing search index...

    Variable SchemaGeneratorConst

    SchemaGenerator: <
        Options extends
            Options<
                {
                    any: [10];
                    array: [1000, unknown, Bounds_array];
                    bigint: [150, Bounds_bigint];
                    boolean: [15];
                    date: [20];
                    integer: [100, Bounds_int];
                    intersect: [
                        6000,
                        [[7500, [string, unknown][]], [7500, [string, unknown][]]],
                    ];
                    literal: [550, string | number | boolean];
                    never: [35];
                    null: [40];
                    number: [200, Bounds_number];
                    object: [7500, [string, unknown][]];
                    optional: [2500, unknown];
                    record: [7000, unknown];
                    string: [250, Bounds_string];
                    symbol: [45];
                    tuple: [8000, unknown[]];
                    undefined: [50];
                    union: [8500, unknown[]];
                    unknown: [55];
                    void: [60];
                },
            >,
    >(
        ...a: [
            options?: Options,
            overrides?: Partial<
                Gen.Base<
                    {
                        any: [10];
                        array: [1000, unknown, Bounds_array];
                        bigint: [150, Bounds_bigint];
                        boolean: [15];
                        date: [20];
                        integer: [100, Bounds_int];
                        intersect: [6000, [[7500, [(...), (...)][]], [7500, [(...), (...)][]]]];
                        literal: [550, string | number | boolean];
                        never: [35];
                        null: [40];
                        number: [200, Bounds_number];
                        object: [7500, [string, unknown][]];
                        optional: [2500, unknown];
                        record: [7000, unknown];
                        string: [250, Bounds_string];
                        symbol: [45];
                        tuple: [8000, unknown[]];
                        undefined: [50];
                        union: [8500, unknown[]];
                        unknown: [55];
                        void: [60];
                    },
                    byTypeName,
                >,
            >,
        ],
    ) => Arbitrary = ...

    A zod schema generator that can be interpreted to produce an arbitrary zod schema (v4, classic).

    The generator supports a wide range of configuration options that are discoverable via the optional options argument.

    Many of those options are forwarded to the corresponding fast-check arbitrary.

    To use it, you'll need to have fast-check installed.

    Note: support for options.minDepth is experimental. If you use it, be advised that even with a minimum depth of 1, the schemas produced will be quite large. Using this option in your CI/CD pipeline is not recommended.

    See also:

    Type declaration

      • <
            Options extends
                Options<
                    {
                        any: [10];
                        array: [1000, unknown, Bounds_array];
                        bigint: [150, Bounds_bigint];
                        boolean: [15];
                        date: [20];
                        integer: [100, Bounds_int];
                        intersect: [
                            6000,
                            [[7500, [string, unknown][]], [7500, [string, unknown][]]],
                        ];
                        literal: [550, string | number | boolean];
                        never: [35];
                        null: [40];
                        number: [200, Bounds_number];
                        object: [7500, [string, unknown][]];
                        optional: [2500, unknown];
                        record: [7000, unknown];
                        string: [250, Bounds_string];
                        symbol: [45];
                        tuple: [8000, unknown[]];
                        undefined: [50];
                        union: [8500, unknown[]];
                        unknown: [55];
                        void: [60];
                    },
                >,
        >(
            ...a: [
                options?: Options,
                overrides?: Partial<
                    Gen.Base<
                        {
                            any: [10];
                            array: [1000, unknown, Bounds_array];
                            bigint: [150, Bounds_bigint];
                            boolean: [15];
                            date: [20];
                            integer: [100, Bounds_int];
                            intersect: [6000, [[7500, [(...), (...)][]], [7500, [(...), (...)][]]]];
                            literal: [550, string | number | boolean];
                            never: [35];
                            null: [40];
                            number: [200, Bounds_number];
                            object: [7500, [string, unknown][]];
                            optional: [2500, unknown];
                            record: [7000, unknown];
                            string: [250, Bounds_string];
                            symbol: [45];
                            tuple: [8000, unknown[]];
                            undefined: [50];
                            union: [8500, unknown[]];
                            unknown: [55];
                            void: [60];
                        },
                        byTypeName,
                    >,
                >,
            ],
        ): Arbitrary
      • Type Parameters

        • Options extends Options<
              {
                  any: [10];
                  array: [1000, unknown, Bounds_array];
                  bigint: [150, Bounds_bigint];
                  boolean: [15];
                  date: [20];
                  integer: [100, Bounds_int];
                  intersect: [
                      6000,
                      [[7500, [string, unknown][]], [7500, [string, unknown][]]],
                  ];
                  literal: [550, string | number | boolean];
                  never: [35];
                  null: [40];
                  number: [200, Bounds_number];
                  object: [7500, [string, unknown][]];
                  optional: [2500, unknown];
                  record: [7000, unknown];
                  string: [250, Bounds_string];
                  symbol: [45];
                  tuple: [8000, unknown[]];
                  undefined: [50];
                  union: [8500, unknown[]];
                  unknown: [55];
                  void: [60];
              },
          >

        Parameters

        • ...a: [
              options?: Options,
              overrides?: Partial<
                  Gen.Base<
                      {
                          any: [10];
                          array: [1000, unknown, Bounds_array];
                          bigint: [150, Bounds_bigint];
                          boolean: [15];
                          date: [20];
                          integer: [100, Bounds_int];
                          intersect: [6000, [[7500, [(...), (...)][]], [7500, [(...), (...)][]]]];
                          literal: [550, string | number | boolean];
                          never: [35];
                          null: [40];
                          number: [200, Bounds_number];
                          object: [7500, [string, unknown][]];
                          optional: [2500, unknown];
                          record: [7000, unknown];
                          string: [250, Bounds_string];
                          symbol: [45];
                          tuple: [8000, unknown[]];
                          undefined: [50];
                          union: [8500, unknown[]];
                          unknown: [55];
                          void: [60];
                      },
                      byTypeName,
                  >,
              >,
          ]

        Returns Arbitrary

    import * as fc from 'fast-check'
    import { z } from 'zod'
    import { zx } from '@traversable/zod'

    const tenSchemas = fc.sample(zx.SchemaGenerator({
    include: ['null', 'boolean', 'number', 'string', 'array', 'object']
    }), 10)

    tenSchemas.forEach((s) => console.log(zx.toString(s)))
    // => z.number()
    // => z.string().max(64)
    // => z.null()
    // => z.array(z.boolean())
    // => z.boolean()
    // => z.object({ "": z.object({ "/d2P} {/": z.boolean() }), "svH2]L'x": z.number().lt(-65536) })
    // => z.null()
    // => z.string()
    // => z.array(z.array(z.null()))
    // => z.object({ "y(Qza": z.boolean(), "G1S\\U 4Y6i": z.object({ "YtO3]ia0cM": z.boolean() }) })