-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
LlmTypeCheckerV3_1.ts
106 lines (92 loc) · 3.08 KB
/
LlmTypeCheckerV3_1.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { ILlmSchemaV3_1 } from "../structures/ILlmSchemaV3_1";
import { OpenApiTypeCheckerBase } from "./internal/OpenApiTypeCheckerBase";
export namespace LlmTypeCheckerV3_1 {
/* -----------------------------------------------------------
TYPE CHECKERS
----------------------------------------------------------- */
export const isNull = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.INull => OpenApiTypeCheckerBase.isNull(schema);
export const isUnknown = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IUnknown =>
OpenApiTypeCheckerBase.isUnknown(schema);
export const isConstant = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IConstant =>
OpenApiTypeCheckerBase.isConstant(schema);
export const isBoolean = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IBoolean =>
OpenApiTypeCheckerBase.isBoolean(schema);
export const isInteger = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IInteger =>
OpenApiTypeCheckerBase.isInteger(schema);
export const isNumber = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.INumber =>
OpenApiTypeCheckerBase.isNumber(schema);
export const isString = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IString =>
OpenApiTypeCheckerBase.isString(schema);
export const isArray = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IArray => OpenApiTypeCheckerBase.isArray(schema);
export const isObject = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IObject =>
OpenApiTypeCheckerBase.isObject(schema);
export const isReference = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IReference =>
OpenApiTypeCheckerBase.isReference(schema);
export const isOneOf = (
schema: ILlmSchemaV3_1,
): schema is ILlmSchemaV3_1.IOneOf => OpenApiTypeCheckerBase.isOneOf(schema);
export const isRecursiveReference = (props: {
$defs?: Record<string, ILlmSchemaV3_1>;
schema: ILlmSchemaV3_1;
}): boolean =>
OpenApiTypeCheckerBase.isRecursiveReference({
prefix: "#/$defs/",
components: {
schemas: props.$defs,
},
schema: props.schema,
});
/* -----------------------------------------------------------
OPERATORS
----------------------------------------------------------- */
export const covers = (props: {
$defs?: Record<string, ILlmSchemaV3_1>;
x: ILlmSchemaV3_1;
y: ILlmSchemaV3_1;
}): boolean =>
OpenApiTypeCheckerBase.covers({
prefix: "#/$defs/",
components: {
schemas: props.$defs,
},
x: props.x,
y: props.y,
});
export const visit = (props: {
closure: (schema: ILlmSchemaV3_1, accessor: string) => void;
$defs?: Record<string, ILlmSchemaV3_1>;
schema: ILlmSchemaV3_1;
accessor?: string;
refAccessor?: string;
}): void =>
OpenApiTypeCheckerBase.visit({
prefix: "#/$defs/",
components: {
schemas: props.$defs,
},
closure: props.closure as any,
schema: props.schema,
accessor: props.accessor,
refAccessor: props.refAccessor,
});
}