Registry / testing / json-schema-fast-check

json-schema-fast-check

JSON →
library0.0.6jsnpmunverified

Generate fast-check arbitraries from JSON Schema for property-based testing. Version 0.0.6, early stage development with limited schema support (subset of JSON Schema). Differentiates by directly integrating JSON Schema with fast-check, enabling property-based tests that automatically generate valid inputs based on schema definitions. Supports faker-js sugar for realistic data. Not production-ready; many JSON Schema features missing (minProperties, if/then/else, oneOf, dependencies as objects).

npm install json-schema-fast-check
INSTALL
IMPORT
SIG · JSON-SCHEMA-FAST-C
J
json-schema-fast-check
testingjavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import jsfc from 'json-schema-fast-check'
const jsfc = require('json-schema-fast-check')
Default export is the main function. ESM-only.
generate
import { generate } from 'json-schema-fast-check'
Named export for single generation. Can also be imported as a property of default.
fc
import fc from 'fast-check'
import { fc } from 'fast-check'
Separate package required. fc is default export from fast-check.

Property-based test that validates all generated objects from schema satisfy constraints.

import jsfc from 'json-schema-fast-check'; import fc from 'fast-check'; const schema = { type: 'object', properties: { name: { type: 'string' }, age: { type: 'integer', minimum: 0 } }, required: ['name'] }; fc.assert( fc.property(jsfc(schema), (obj: any) => { return typeof obj.name === 'string' && (obj.age === undefined || obj.age >= 0); }) );
Debug
Known issues
deprecatedSchema features like minProperties, if/then/else, oneOf are not implemented.
fix
Avoid using unimplemented schema constructs or use alternative library like json-schema-faker or quicktype.
affects: >=0.0.1
gotchaDefault export name is arbitrary; import as any name you want.
fix
Import default as jsfc or any other name: import YourName from 'json-schema-fast-check'.
affects: >=0.0.1
gotchaSchema with dependencies as objects not supported.
fix
Only use array-style dependencies.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: jsfc is not a function
Using default import with wrong syntax (e.g., { jsfc })
fix
Use import jsfc from 'json-schema-fast-check' not import { jsfc } from 'json-schema-fast-check'
ReferenceError: fc is not defined
Forgot to import fast-check
fix
Add import fc from 'fast-check'
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
fast-checkrequiredCore dependency for property-based testing arbitraries
Agent activity
8 hits · last 30 days
node
8
Resources
json-schema-fast-check — npm install json-schema-fast-check · libregistry