Skip to content

API ​

makeArbitrary(schema) ​

Creates a fast-check arbitrary of the values a schema accepts.

ParameterTypeDescription
schemaSchema<T>Any Juniper schema.

Returns Arbitrary<T>, typed by the schema. Values are generated from the same seed the same way, so a fast-check failure replays. Its shrinking stays valid.

Throws while building, and while generating when the schema can only be found out by trying.

Errors ​

Each has path, a JSON Pointer to the part of the schema responsible (#/properties/name), and extends JuniperArbitraryError.

ErrorThrown when
UnsatisfiableSchemaErrorNothing matches (neverSchema(), minimum above maximum, recursion with no way out), or no valid value turned up in time.
UnsupportedSchemaErrorThe schema doesn't compile, such as a $ref from .ref() to something outside it. Use .define() for definitions a schema should carry.