schema-truth 0.0.0-stage → 0.8.1
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 +143 -2
- package/dist/ajv-DS9gtNZC.js +105 -0
- package/dist/ajv.d.ts +24 -0
- package/dist/ajv.js +1 -0
- package/dist/arktype-CRZ8vXZ5.js +803 -0
- package/dist/arktype.d.ts +10 -0
- package/dist/arktype.js +1 -0
- package/dist/cli/ajv.d.ts +1 -0
- package/dist/cli/ajv.js +15 -0
- package/dist/cli/arktype.d.ts +1 -0
- package/dist/cli/arktype.js +15 -0
- package/dist/cli/effect.d.ts +1 -0
- package/dist/cli/effect.js +15 -0
- package/dist/cli/typebox.d.ts +1 -0
- package/dist/cli/typebox.js +15 -0
- package/dist/cli/valibot.d.ts +1 -0
- package/dist/cli/valibot.js +15 -0
- package/dist/cli/yup.d.ts +1 -0
- package/dist/cli/yup.js +15 -0
- package/dist/cli/zod.d.ts +1 -0
- package/dist/cli/zod.js +15 -0
- package/dist/cli-eAY8LqwP.js +124 -0
- package/dist/effect-BkWovUi3.js +678 -0
- package/dist/effect.d.ts +12 -0
- package/dist/effect.js +1 -0
- package/dist/helper-CbeedY35.js +1798 -0
- package/dist/index-DYzAccyT.d.ts +69 -0
- package/dist/index-G7UqNQ4w.d.ts +603 -0
- package/dist/index.d.ts +332 -0
- package/dist/index.js +10 -0
- package/dist/parser-CyJ2auea.js +36 -0
- package/dist/typebox-wYeJqy7T.js +563 -0
- package/dist/typebox.d.ts +21 -0
- package/dist/typebox.js +1 -0
- package/dist/utils-Bky98UmP.js +1146 -0
- package/dist/valibot-DQUEDYKt.js +705 -0
- package/dist/valibot.d.ts +9 -0
- package/dist/valibot.js +1 -0
- package/dist/yup-BMpa9Co1.js +92 -0
- package/dist/yup.d.ts +17 -0
- package/dist/yup.js +1 -0
- package/dist/zod-Dq9LtqPL.js +816 -0
- package/dist/zod.d.ts +9 -0
- package/dist/zod.js +1 -0
- package/package.json +112 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { h as ParamStyle, m as ParamIn, r as JSONSchema } from "./index-G7UqNQ4w.js";
|
|
2
|
+
//#region src/helper/schema.d.ts
|
|
3
|
+
/** Named schemas a `default` beside a `$ref` is reconciled against. */
|
|
4
|
+
type SchemaDefinitions = {
|
|
5
|
+
readonly [name: string]: JSONSchema;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/options/index.d.ts
|
|
9
|
+
/** The options every `schemaTo<Library>` document generator accepts. */
|
|
10
|
+
type GenerateOptions = {
|
|
11
|
+
/** Also export the inferred TypeScript type. Default: `true`. */
|
|
12
|
+
readonly exportType?: boolean;
|
|
13
|
+
/** Name schemas as OpenAPI components are named, and resolve `#/components/schemas/` refs. */
|
|
14
|
+
readonly openapi?: boolean;
|
|
15
|
+
/** Emit readonly arrays and objects. */
|
|
16
|
+
readonly readonly?: boolean;
|
|
17
|
+
/** Honour the code-emitting `x-*` extensions. Unsafe: see `helper/code-extensions.ts`. */
|
|
18
|
+
readonly unsafeCodeExtensions?: boolean;
|
|
19
|
+
/** The OpenAPI parameter location the schema is emitted for; its values are coerced from text. */
|
|
20
|
+
readonly paramIn?: ParamIn;
|
|
21
|
+
/**
|
|
22
|
+
* The parameter's `style`, which decides how its text is split into an array or an
|
|
23
|
+
* object (`form` with `explode: false` reads `1,2,3`, `deepObject` gathers `deep[key]`).
|
|
24
|
+
* Defaults to `form` for `query` / `cookie` / `formData` and `simple` for `path` / `header`.
|
|
25
|
+
* Applies to the root schema. A property's own serialization is `x-style` / `x-explode` /
|
|
26
|
+
* `x-allowEmptyValue`, or {@link GenerateOptions.properties}. Honoured by Zod, Valibot,
|
|
27
|
+
* Effect Schema and ArkType; a no-op for TypeBox, Ajv and Yup.
|
|
28
|
+
*/
|
|
29
|
+
readonly style?: ParamStyle;
|
|
30
|
+
/**
|
|
31
|
+
* The parameter's `explode`. Defaults to `true` for `style: form`, else `false`. Honoured
|
|
32
|
+
* where `style` is.
|
|
33
|
+
*/
|
|
34
|
+
readonly explode?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The parameter's `allowEmptyValue` — an empty value reads as an absent one. Honoured
|
|
37
|
+
* where `style` is.
|
|
38
|
+
*/
|
|
39
|
+
readonly allowEmptyValue?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The media type of the parameter's `content`. A JSON one (`application/json`, `*+json`)
|
|
42
|
+
* reads the text as a JSON document and validates it without coercion. Honoured where
|
|
43
|
+
* `style` is.
|
|
44
|
+
*/
|
|
45
|
+
readonly contentType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Per-property serialization for an object schema emitted with `paramIn`: each named
|
|
48
|
+
* property is read with its own `style` / `explode` / `allowEmptyValue` instead of the
|
|
49
|
+
* root's. A keyword on the property (`x-style`, `x-explode`, `x-allowEmptyValue`) fills
|
|
50
|
+
* whatever this map leaves unset, and survives inside `$defs`. Honoured where `style` is.
|
|
51
|
+
*/
|
|
52
|
+
readonly properties?: {
|
|
53
|
+
readonly [name: string]: {
|
|
54
|
+
readonly style?: ParamStyle;
|
|
55
|
+
readonly explode?: boolean;
|
|
56
|
+
readonly allowEmptyValue?: boolean;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Named schemas used to reconcile a `default` written beside a `$ref`. `schemaTo*`
|
|
61
|
+
* fills this from the document's `$defs` / `definitions`. Honoured by Zod, Valibot,
|
|
62
|
+
* Effect Schema and TypeBox.
|
|
63
|
+
*/
|
|
64
|
+
readonly definitions?: SchemaDefinitions;
|
|
65
|
+
};
|
|
66
|
+
/** The options threaded through every node emitter: `GenerateOptions` without `exportType`. */
|
|
67
|
+
type EmitOptions = Omit<GenerateOptions, 'exportType'>;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { GenerateOptions as n, EmitOptions as t };
|