# @smartlyio/oats-fast-check

> fast-check value generator for smartlyio/oats types

Latest version **7.9.3** (published 2026-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @smartlyio/oats-fast-check
pnpm add @smartlyio/oats-fast-check
yarn add @smartlyio/oats-fast-check
bun add @smartlyio/oats-fast-check
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 7.9.3 |
| Published | 2026-09-17 |
| First published | 2020-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 36.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 40 |
| Author | Smartly.io |
| Maintainers | smartlyio |
| Keywords | oats, openapi3, rest, generator, typescript, server, client |

## Links

- npm: https://www.npmjs.com/package/@smartlyio/oats-fast-check
- Repository: https://github.com/smartlyio/oats
- npm.io page: https://npm.io/package/@smartlyio/oats-fast-check

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [randexp](https://npm.io/package/randexp.md) ^0.5.3

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 7.9.3 (latest) — 2026-09-17
- 7.6.2-alpha.21 (canary) — 2025-12-14
- 7.9.2 — 2026-09-17
- 7.9.1 — 2026-09-04
- 7.9.0 — 2026-09-04
- 7.8.0 — 2026-06-01
- 7.7.8 — 2026-04-01
- 7.7.7 — 2026-03-31
- 7.7.6 — 2026-03-11
- 7.6.3 — 2025-12-16
- 7.6.2-alpha.20 — 2025-12-14
- 7.6.2-alpha.19 — 2025-12-12
- 7.6.1 — 2025-05-23
- 7.6.0 — 2025-01-09
- 7.5.1 — 2024-11-11
- … 106 more at https://npm.io/package/@smartlyio/oats-fast-check/versions

## README

# Fast-check generators for smartlyio/oats

[Fast-check](https://www.npmjs.com/package/fast-check)  generators for [@smartlyio/oats](https://www.npmjs.com/package/@smartlyio/oats) types.


## generator.named

Generate values of named types from the openapi specification. Here using a jest wrapper.

```ts
// pnpm jest examples/type.spec.ts
import * as fc from 'fast-check';
import { generator } from '../src/index';
import * as runtime from '@smartlyio/oats-runtime';
import * as types from '../tmp/openapi.types.generated';

describe('value generation', () => {
  it ('generates valid values', () =>
    fc.assert(
      fc.property(
        // create a fast-check Arbitrary from the type structure
        generator.named(types.typeTestObject),
        (value: types.TestObject) => {
          // assert that all the generated values are valid
          const json = runtime.valueClass.toJSON(value);
          types.typeTestObject.maker(json).success();
        }
      )
  ))
});

```

## generator.override

Override automatic generators globally with a custom Arbitrary

```
// pnpm jest examples/override.spec.ts
import * as fc from 'fast-check';
import { generator } from '../src/index';
import * as types from '../tmp/openapi.types.generated';

describe('overriding generators', () => {
  it ('.override provides custom generator for type', () => {
    generator.override(types.typeTestTarget, fc.constant('overridden value'));
    fc.assert(
      fc.property(
        generator.named(types.typeTestTarget),
        (value: types.TestTarget) => {
          expect(value).toEqual('overridden value');
        }
      )
    );
  })

  it ('.clear removes override', () => {
    generator.override(types.typeTestTarget, fc.constant('overridden value'));
    generator.clear(types.typeTestTarget);
    fc.assert(
      fc.property(
        generator.named(types.typeTestTarget),
        (value: types.TestTarget) => {
          expect(value).not.toEqual('overridden value');
        }
      )
    );
  })
});

```

---
_Source: https://npm.io/package/@smartlyio/oats-fast-check · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
