@atom8n/json-schema-to-zod 1.6.6 → 1.6.8
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/.turbo/turbo-build.log +11 -16
- package/package.json +2 -2
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/json-schema-to-zod.js +0 -12
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/parsers/parse-all-of.js +0 -37
- package/dist/cjs/parsers/parse-any-of.js +0 -16
- package/dist/cjs/parsers/parse-array.js +0 -18
- package/dist/cjs/parsers/parse-boolean.js +0 -8
- package/dist/cjs/parsers/parse-const.js +0 -8
- package/dist/cjs/parsers/parse-default.js +0 -8
- package/dist/cjs/parsers/parse-enum.js +0 -18
- package/dist/cjs/parsers/parse-if-then-else.js +0 -23
- package/dist/cjs/parsers/parse-multiple-type.js +0 -9
- package/dist/cjs/parsers/parse-not.js +0 -12
- package/dist/cjs/parsers/parse-null.js +0 -8
- package/dist/cjs/parsers/parse-nullable.js +0 -12
- package/dist/cjs/parsers/parse-number.js +0 -49
- package/dist/cjs/parsers/parse-object.js +0 -206
- package/dist/cjs/parsers/parse-one-of.js +0 -32
- package/dist/cjs/parsers/parse-schema.js +0 -159
- package/dist/cjs/parsers/parse-string.js +0 -42
- package/dist/cjs/types.js +0 -2
- package/dist/cjs/utils/extend-schema.js +0 -11
- package/dist/cjs/utils/half.js +0 -7
- package/dist/cjs/utils/its.js +0 -23
- package/dist/cjs/utils/omit.js +0 -10
- package/dist/esm/index.js +0 -1
- package/dist/esm/json-schema-to-zod.js +0 -8
- package/dist/esm/package.json +0 -1
- package/dist/esm/parsers/parse-all-of.js +0 -34
- package/dist/esm/parsers/parse-any-of.js +0 -12
- package/dist/esm/parsers/parse-array.js +0 -14
- package/dist/esm/parsers/parse-boolean.js +0 -4
- package/dist/esm/parsers/parse-const.js +0 -4
- package/dist/esm/parsers/parse-default.js +0 -4
- package/dist/esm/parsers/parse-enum.js +0 -14
- package/dist/esm/parsers/parse-if-then-else.js +0 -19
- package/dist/esm/parsers/parse-multiple-type.js +0 -5
- package/dist/esm/parsers/parse-not.js +0 -8
- package/dist/esm/parsers/parse-null.js +0 -4
- package/dist/esm/parsers/parse-nullable.js +0 -8
- package/dist/esm/parsers/parse-number.js +0 -45
- package/dist/esm/parsers/parse-object.js +0 -170
- package/dist/esm/parsers/parse-one-of.js +0 -28
- package/dist/esm/parsers/parse-schema.js +0 -122
- package/dist/esm/parsers/parse-string.js +0 -38
- package/dist/esm/types.js +0 -1
- package/dist/esm/utils/extend-schema.js +0 -8
- package/dist/esm/utils/half.js +0 -3
- package/dist/esm/utils/its.js +0 -20
- package/dist/esm/utils/omit.js +0 -6
- package/dist/types/index.d.ts +0 -2
- package/dist/types/json-schema-to-zod.d.ts +0 -3
- package/dist/types/parsers/parse-all-of.d.ts +0 -5
- package/dist/types/parsers/parse-any-of.d.ts +0 -5
- package/dist/types/parsers/parse-array.d.ts +0 -5
- package/dist/types/parsers/parse-boolean.d.ts +0 -5
- package/dist/types/parsers/parse-const.d.ts +0 -5
- package/dist/types/parsers/parse-default.d.ts +0 -3
- package/dist/types/parsers/parse-enum.d.ts +0 -5
- package/dist/types/parsers/parse-if-then-else.d.ts +0 -7
- package/dist/types/parsers/parse-multiple-type.d.ts +0 -5
- package/dist/types/parsers/parse-not.d.ts +0 -5
- package/dist/types/parsers/parse-null.d.ts +0 -5
- package/dist/types/parsers/parse-nullable.d.ts +0 -7
- package/dist/types/parsers/parse-number.d.ts +0 -5
- package/dist/types/parsers/parse-object.d.ts +0 -5
- package/dist/types/parsers/parse-one-of.d.ts +0 -5
- package/dist/types/parsers/parse-schema.d.ts +0 -3
- package/dist/types/parsers/parse-string.d.ts +0 -5
- package/dist/types/types.d.ts +0 -66
- package/dist/types/utils/extend-schema.d.ts +0 -3
- package/dist/types/utils/half.d.ts +0 -1
- package/dist/types/utils/its.d.ts +0 -45
- package/dist/types/utils/omit.d.ts +0 -1
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { parseSchema } from './parse-schema';
|
|
3
|
-
export const parseOneOf = (jsonSchema, refs) => {
|
|
4
|
-
if (!jsonSchema.oneOf.length) {
|
|
5
|
-
return z.any();
|
|
6
|
-
}
|
|
7
|
-
if (jsonSchema.oneOf.length === 1) {
|
|
8
|
-
return parseSchema(jsonSchema.oneOf[0], {
|
|
9
|
-
...refs,
|
|
10
|
-
path: [...refs.path, 'oneOf', 0],
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
return z.any().superRefine((x, ctx) => {
|
|
14
|
-
const schemas = jsonSchema.oneOf.map((schema, i) => parseSchema(schema, {
|
|
15
|
-
...refs,
|
|
16
|
-
path: [...refs.path, 'oneOf', i],
|
|
17
|
-
}));
|
|
18
|
-
const unionErrors = schemas.reduce((errors, schema) => ((result) => (result.error ? [...errors, result.error] : errors))(schema.safeParse(x)), []);
|
|
19
|
-
if (schemas.length - unionErrors.length !== 1) {
|
|
20
|
-
ctx.addIssue({
|
|
21
|
-
path: ctx.path,
|
|
22
|
-
code: 'invalid_union',
|
|
23
|
-
unionErrors,
|
|
24
|
-
message: 'Invalid input: Should pass single schema',
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
import { parseAllOf } from './parse-all-of';
|
|
3
|
-
import { parseAnyOf } from './parse-any-of';
|
|
4
|
-
import { parseArray } from './parse-array';
|
|
5
|
-
import { parseBoolean } from './parse-boolean';
|
|
6
|
-
import { parseConst } from './parse-const';
|
|
7
|
-
import { parseDefault } from './parse-default';
|
|
8
|
-
import { parseEnum } from './parse-enum';
|
|
9
|
-
import { parseIfThenElse } from './parse-if-then-else';
|
|
10
|
-
import { parseMultipleType } from './parse-multiple-type';
|
|
11
|
-
import { parseNot } from './parse-not';
|
|
12
|
-
import { parseNull } from './parse-null';
|
|
13
|
-
import { parseNullable } from './parse-nullable';
|
|
14
|
-
import { parseNumber } from './parse-number';
|
|
15
|
-
import { parseObject } from './parse-object';
|
|
16
|
-
import { parseOneOf } from './parse-one-of';
|
|
17
|
-
import { parseString } from './parse-string';
|
|
18
|
-
import { its } from '../utils/its';
|
|
19
|
-
const addDescribes = (jsonSchema, zodSchema) => {
|
|
20
|
-
if (jsonSchema.description) {
|
|
21
|
-
zodSchema = zodSchema.describe(jsonSchema.description);
|
|
22
|
-
}
|
|
23
|
-
return zodSchema;
|
|
24
|
-
};
|
|
25
|
-
const addDefaults = (jsonSchema, zodSchema) => {
|
|
26
|
-
if (jsonSchema.default !== undefined) {
|
|
27
|
-
zodSchema = zodSchema.default(jsonSchema.default);
|
|
28
|
-
}
|
|
29
|
-
return zodSchema;
|
|
30
|
-
};
|
|
31
|
-
const addAnnotations = (jsonSchema, zodSchema) => {
|
|
32
|
-
if (jsonSchema.readOnly) {
|
|
33
|
-
zodSchema = zodSchema.readonly();
|
|
34
|
-
}
|
|
35
|
-
return zodSchema;
|
|
36
|
-
};
|
|
37
|
-
const selectParser = (schema, refs) => {
|
|
38
|
-
if (its.a.nullable(schema)) {
|
|
39
|
-
return parseNullable(schema, refs);
|
|
40
|
-
}
|
|
41
|
-
else if (its.an.object(schema)) {
|
|
42
|
-
return parseObject(schema, refs);
|
|
43
|
-
}
|
|
44
|
-
else if (its.an.array(schema)) {
|
|
45
|
-
return parseArray(schema, refs);
|
|
46
|
-
}
|
|
47
|
-
else if (its.an.anyOf(schema)) {
|
|
48
|
-
return parseAnyOf(schema, refs);
|
|
49
|
-
}
|
|
50
|
-
else if (its.an.allOf(schema)) {
|
|
51
|
-
return parseAllOf(schema, refs);
|
|
52
|
-
}
|
|
53
|
-
else if (its.a.oneOf(schema)) {
|
|
54
|
-
return parseOneOf(schema, refs);
|
|
55
|
-
}
|
|
56
|
-
else if (its.a.not(schema)) {
|
|
57
|
-
return parseNot(schema, refs);
|
|
58
|
-
}
|
|
59
|
-
else if (its.an.enum(schema)) {
|
|
60
|
-
return parseEnum(schema); //<-- needs to come before primitives
|
|
61
|
-
}
|
|
62
|
-
else if (its.a.const(schema)) {
|
|
63
|
-
return parseConst(schema);
|
|
64
|
-
}
|
|
65
|
-
else if (its.a.multipleType(schema)) {
|
|
66
|
-
return parseMultipleType(schema, refs);
|
|
67
|
-
}
|
|
68
|
-
else if (its.a.primitive(schema, 'string')) {
|
|
69
|
-
return parseString(schema);
|
|
70
|
-
}
|
|
71
|
-
else if (its.a.primitive(schema, 'number') || its.a.primitive(schema, 'integer')) {
|
|
72
|
-
return parseNumber(schema);
|
|
73
|
-
}
|
|
74
|
-
else if (its.a.primitive(schema, 'boolean')) {
|
|
75
|
-
return parseBoolean(schema);
|
|
76
|
-
}
|
|
77
|
-
else if (its.a.primitive(schema, 'null')) {
|
|
78
|
-
return parseNull(schema);
|
|
79
|
-
}
|
|
80
|
-
else if (its.a.conditional(schema)) {
|
|
81
|
-
return parseIfThenElse(schema, refs);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
return parseDefault(schema);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
export const parseSchema = (jsonSchema, refs = { seen: new Map(), path: [] }, blockMeta) => {
|
|
88
|
-
if (typeof jsonSchema !== 'object')
|
|
89
|
-
return jsonSchema ? z.any() : z.never();
|
|
90
|
-
if (refs.parserOverride) {
|
|
91
|
-
const custom = refs.parserOverride(jsonSchema, refs);
|
|
92
|
-
if (custom instanceof z.ZodType) {
|
|
93
|
-
return custom;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
let seen = refs.seen.get(jsonSchema);
|
|
97
|
-
if (seen) {
|
|
98
|
-
if (seen.r !== undefined) {
|
|
99
|
-
return seen.r;
|
|
100
|
-
}
|
|
101
|
-
if (refs.depth === undefined || seen.n >= refs.depth) {
|
|
102
|
-
return z.any();
|
|
103
|
-
}
|
|
104
|
-
seen.n += 1;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
seen = { r: undefined, n: 0 };
|
|
108
|
-
refs.seen.set(jsonSchema, seen);
|
|
109
|
-
}
|
|
110
|
-
let parsedZodSchema = selectParser(jsonSchema, refs);
|
|
111
|
-
if (!blockMeta) {
|
|
112
|
-
if (!refs.withoutDescribes) {
|
|
113
|
-
parsedZodSchema = addDescribes(jsonSchema, parsedZodSchema);
|
|
114
|
-
}
|
|
115
|
-
if (!refs.withoutDefaults) {
|
|
116
|
-
parsedZodSchema = addDefaults(jsonSchema, parsedZodSchema);
|
|
117
|
-
}
|
|
118
|
-
parsedZodSchema = addAnnotations(jsonSchema, parsedZodSchema);
|
|
119
|
-
}
|
|
120
|
-
seen.r = parsedZodSchema;
|
|
121
|
-
return parsedZodSchema;
|
|
122
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { extendSchemaWithMessage } from '../utils/extend-schema';
|
|
3
|
-
export const parseString = (jsonSchema) => {
|
|
4
|
-
let zodSchema = z.string();
|
|
5
|
-
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, 'format', (zs, format, errorMsg) => {
|
|
6
|
-
switch (format) {
|
|
7
|
-
case 'email':
|
|
8
|
-
return zs.email(errorMsg);
|
|
9
|
-
case 'ip':
|
|
10
|
-
return zs.ip(errorMsg);
|
|
11
|
-
case 'ipv4':
|
|
12
|
-
return zs.ip({ version: 'v4', message: errorMsg });
|
|
13
|
-
case 'ipv6':
|
|
14
|
-
return zs.ip({ version: 'v6', message: errorMsg });
|
|
15
|
-
case 'uri':
|
|
16
|
-
return zs.url(errorMsg);
|
|
17
|
-
case 'uuid':
|
|
18
|
-
return zs.uuid(errorMsg);
|
|
19
|
-
case 'date-time':
|
|
20
|
-
return zs.datetime({ offset: true, message: errorMsg });
|
|
21
|
-
case 'time':
|
|
22
|
-
return zs.time(errorMsg);
|
|
23
|
-
case 'date':
|
|
24
|
-
return zs.date(errorMsg);
|
|
25
|
-
case 'binary':
|
|
26
|
-
return zs.base64(errorMsg);
|
|
27
|
-
case 'duration':
|
|
28
|
-
return zs.duration(errorMsg);
|
|
29
|
-
default:
|
|
30
|
-
return zs;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, 'contentEncoding', (zs, _, errorMsg) => zs.base64(errorMsg));
|
|
34
|
-
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, 'pattern', (zs, pattern, errorMsg) => zs.regex(new RegExp(pattern), errorMsg));
|
|
35
|
-
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, 'minLength', (zs, minLength, errorMsg) => zs.min(minLength, errorMsg));
|
|
36
|
-
zodSchema = extendSchemaWithMessage(zodSchema, jsonSchema, 'maxLength', (zs, maxLength, errorMsg) => zs.max(maxLength, errorMsg));
|
|
37
|
-
return zodSchema;
|
|
38
|
-
};
|
package/dist/esm/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function extendSchemaWithMessage(zodSchema, jsonSchema, key, extend) {
|
|
2
|
-
const value = jsonSchema[key];
|
|
3
|
-
if (value !== undefined) {
|
|
4
|
-
const errorMessage = jsonSchema.errorMessage?.[key];
|
|
5
|
-
return extend(zodSchema, value, errorMessage);
|
|
6
|
-
}
|
|
7
|
-
return zodSchema;
|
|
8
|
-
}
|
package/dist/esm/utils/half.js
DELETED
package/dist/esm/utils/its.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const its = {
|
|
2
|
-
an: {
|
|
3
|
-
object: (x) => x.type === 'object',
|
|
4
|
-
array: (x) => x.type === 'array',
|
|
5
|
-
anyOf: (x) => x.anyOf !== undefined,
|
|
6
|
-
allOf: (x) => x.allOf !== undefined,
|
|
7
|
-
enum: (x) => x.enum !== undefined,
|
|
8
|
-
},
|
|
9
|
-
a: {
|
|
10
|
-
nullable: (x) =>
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
12
|
-
x.nullable === true,
|
|
13
|
-
multipleType: (x) => Array.isArray(x.type),
|
|
14
|
-
not: (x) => x.not !== undefined,
|
|
15
|
-
const: (x) => x.const !== undefined,
|
|
16
|
-
primitive: (x, p) => x.type === p,
|
|
17
|
-
conditional: (x) => Boolean('if' in x && x.if && 'then' in x && 'else' in x && x.then && x.else),
|
|
18
|
-
oneOf: (x) => x.oneOf !== undefined,
|
|
19
|
-
},
|
|
20
|
-
};
|
package/dist/esm/utils/omit.js
DELETED
package/dist/types/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { JsonSchemaObject, Serializable } from '../types';
|
|
3
|
-
export declare const parseEnum: (jsonSchema: JsonSchemaObject & {
|
|
4
|
-
enum: Serializable[];
|
|
5
|
-
}) => z.ZodNever | z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny]> | z.ZodLiteral<z.Primitive> | z.ZodEnum<[string]>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';
|
|
3
|
-
export declare const parseIfThenElse: (jsonSchema: JsonSchemaObject & {
|
|
4
|
-
if: JsonSchema;
|
|
5
|
-
then: JsonSchema;
|
|
6
|
-
else: JsonSchema;
|
|
7
|
-
}, refs: Refs) => z.ZodEffects<z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny]>, any, any>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { JsonSchemaObject, Refs } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* For compatibility with open api 3.0 nullable
|
|
4
|
-
*/
|
|
5
|
-
export declare const parseNullable: (jsonSchema: JsonSchemaObject & {
|
|
6
|
-
nullable: true;
|
|
7
|
-
}, refs: Refs) => import("zod").ZodNullable<import("zod").ZodTypeAny>;
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { ZodTypeAny } from 'zod';
|
|
2
|
-
export type Serializable = {
|
|
3
|
-
[key: string]: Serializable;
|
|
4
|
-
} | Serializable[] | string | number | boolean | null;
|
|
5
|
-
export type JsonSchema = JsonSchemaObject | boolean;
|
|
6
|
-
export type JsonSchemaObject = {
|
|
7
|
-
type?: string | string[];
|
|
8
|
-
properties?: {
|
|
9
|
-
[key: string]: JsonSchema;
|
|
10
|
-
};
|
|
11
|
-
additionalProperties?: JsonSchema;
|
|
12
|
-
unevaluatedProperties?: JsonSchema;
|
|
13
|
-
patternProperties?: {
|
|
14
|
-
[key: string]: JsonSchema;
|
|
15
|
-
};
|
|
16
|
-
minProperties?: number;
|
|
17
|
-
maxProperties?: number;
|
|
18
|
-
required?: string[] | boolean;
|
|
19
|
-
propertyNames?: JsonSchema;
|
|
20
|
-
items?: JsonSchema | JsonSchema[];
|
|
21
|
-
additionalItems?: JsonSchema;
|
|
22
|
-
minItems?: number;
|
|
23
|
-
maxItems?: number;
|
|
24
|
-
uniqueItems?: boolean;
|
|
25
|
-
minLength?: number;
|
|
26
|
-
maxLength?: number;
|
|
27
|
-
pattern?: string;
|
|
28
|
-
format?: string;
|
|
29
|
-
minimum?: number;
|
|
30
|
-
maximum?: number;
|
|
31
|
-
exclusiveMinimum?: number | boolean;
|
|
32
|
-
exclusiveMaximum?: number | boolean;
|
|
33
|
-
multipleOf?: number;
|
|
34
|
-
anyOf?: JsonSchema[];
|
|
35
|
-
allOf?: JsonSchema[];
|
|
36
|
-
oneOf?: JsonSchema[];
|
|
37
|
-
if?: JsonSchema;
|
|
38
|
-
then?: JsonSchema;
|
|
39
|
-
else?: JsonSchema;
|
|
40
|
-
const?: Serializable;
|
|
41
|
-
enum?: Serializable[];
|
|
42
|
-
errorMessage?: {
|
|
43
|
-
[key: string]: string | undefined;
|
|
44
|
-
};
|
|
45
|
-
description?: string;
|
|
46
|
-
default?: Serializable;
|
|
47
|
-
readOnly?: boolean;
|
|
48
|
-
not?: JsonSchema;
|
|
49
|
-
contentEncoding?: string;
|
|
50
|
-
nullable?: boolean;
|
|
51
|
-
};
|
|
52
|
-
export type ParserSelector = (schema: JsonSchemaObject, refs: Refs) => ZodTypeAny;
|
|
53
|
-
export type ParserOverride = (schema: JsonSchemaObject, refs: Refs) => ZodTypeAny | undefined;
|
|
54
|
-
export type JsonSchemaToZodOptions = {
|
|
55
|
-
withoutDefaults?: boolean;
|
|
56
|
-
withoutDescribes?: boolean;
|
|
57
|
-
parserOverride?: ParserOverride;
|
|
58
|
-
depth?: number;
|
|
59
|
-
};
|
|
60
|
-
export type Refs = JsonSchemaToZodOptions & {
|
|
61
|
-
path: Array<string | number>;
|
|
62
|
-
seen: Map<object | boolean, {
|
|
63
|
-
n: number;
|
|
64
|
-
r: ZodTypeAny | undefined;
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
import type { JsonSchemaObject } from '../types';
|
|
3
|
-
export declare function extendSchemaWithMessage<TZod extends z.ZodTypeAny, TJson extends JsonSchemaObject, TKey extends keyof TJson>(zodSchema: TZod, jsonSchema: TJson, key: TKey, extend: (zodSchema: TZod, value: NonNullable<TJson[TKey]>, errorMessage?: string) => TZod): TZod;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const half: <T>(arr: T[]) => [T[], T[]];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { JsonSchema, JsonSchemaObject, Serializable } from '../types';
|
|
2
|
-
export declare const its: {
|
|
3
|
-
an: {
|
|
4
|
-
object: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
5
|
-
type: "object";
|
|
6
|
-
};
|
|
7
|
-
array: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
8
|
-
type: "array";
|
|
9
|
-
};
|
|
10
|
-
anyOf: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
11
|
-
anyOf: JsonSchema[];
|
|
12
|
-
};
|
|
13
|
-
allOf: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
14
|
-
allOf: JsonSchema[];
|
|
15
|
-
};
|
|
16
|
-
enum: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
17
|
-
enum: Serializable | Serializable[];
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
a: {
|
|
21
|
-
nullable: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
22
|
-
nullable: true;
|
|
23
|
-
};
|
|
24
|
-
multipleType: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
25
|
-
type: string[];
|
|
26
|
-
};
|
|
27
|
-
not: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
28
|
-
not: JsonSchema;
|
|
29
|
-
};
|
|
30
|
-
const: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
31
|
-
const: Serializable;
|
|
32
|
-
};
|
|
33
|
-
primitive: <T extends "string" | "number" | "integer" | "boolean" | "null">(x: JsonSchemaObject, p: T) => x is JsonSchemaObject & {
|
|
34
|
-
type: T;
|
|
35
|
-
};
|
|
36
|
-
conditional: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
37
|
-
if: JsonSchema;
|
|
38
|
-
then: JsonSchema;
|
|
39
|
-
else: JsonSchema;
|
|
40
|
-
};
|
|
41
|
-
oneOf: (x: JsonSchemaObject) => x is JsonSchemaObject & {
|
|
42
|
-
oneOf: JsonSchema[];
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const omit: <T extends object, K extends keyof T>(obj: T, ...keys: K[]) => Omit<T, K>;
|