@amritk/generate-examples 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -36,7 +36,8 @@ An `index.ts` barrel re-exports everything.
|
|
|
36
36
|
> The generated arbitraries import `fast-check`, so consumers need it installed
|
|
37
37
|
> (`npm i -D fast-check`). An arbitrary whose schema uses a keyword no `fc.*`
|
|
38
38
|
> combinator captures on its own (`if`/`then`/`else`, `not`, exclusive `oneOf`,
|
|
39
|
-
> and the presence-gated object keywords
|
|
39
|
+
> `contains`, and the presence-gated object keywords — `patternProperties`,
|
|
40
|
+
> `propertyNames`, `dependent*`, `min`/`maxProperties`) also imports `@amritk/runtime-validators`
|
|
40
41
|
> for a post-generation validating filter; files that need no such filter don't.
|
|
41
42
|
> The static `fooExample` values have no runtime dependencies.
|
|
42
43
|
>
|
|
@@ -125,7 +126,7 @@ const res = await fetch('/users', { method: 'POST', body: JSON.stringify(userExa
|
|
|
125
126
|
| Export | Description |
|
|
126
127
|
|:---|:---|
|
|
127
128
|
| `buildExampleSchema(schema, rootName, suffix?)` | Walks the `$ref` graph and returns a `GeneratedFile[]` (one file per schema + an `index.ts`). |
|
|
128
|
-
| `generateArbitrary(schema, typeName, suffix?)` | Returns the `export const …Arbitrary` source for a single schema node. |
|
|
129
|
+
| `generateArbitrary(schema, typeName, suffix?, lazyRefFilenames?, rootSchema?)` | Returns the `export const …Arbitrary` source for a single schema node. |
|
|
129
130
|
| `generateExampleConst(schema, typeName, rootSchema?)` | Returns the `export const …Example` source for a single schema node. |
|
|
130
131
|
| `deriveExample(schema, rootSchema?)` | Returns a concrete, schema-valid JavaScript value (no code-generation). |
|
|
131
132
|
| `serializeValue(value)` | Serializes a derived value to a TypeScript source expression (handles `Date`/`bigint`). |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amritk/generate-examples",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Generate fast-check arbitraries and example values from JSON Schemas.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"json-schema-typed": "^8.0.1",
|
|
58
|
-
"@amritk/helpers": "^0.
|
|
59
|
-
"@amritk/runtime-validators": "^0.13.
|
|
58
|
+
"@amritk/helpers": "^0.19.0",
|
|
59
|
+
"@amritk/runtime-validators": "^0.13.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"ajv": "^8.17.1"
|