typebox 1.0.43 → 1.0.45
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/build/schema/build.d.mts +6 -6
- package/build/schema/build.mjs +6 -4
- package/build/schema/check.d.mts +3 -3
- package/build/schema/check.mjs +4 -2
- package/build/schema/engine/_context.d.mts +6 -16
- package/build/schema/engine/_context.mjs +11 -34
- package/build/schema/engine/_externals.d.mts +1 -1
- package/build/schema/engine/_externals.mjs +2 -2
- package/build/schema/engine/_functions.d.mts +3 -2
- package/build/schema/engine/_functions.mjs +6 -5
- package/build/schema/engine/_guard.d.mts +5 -4
- package/build/schema/engine/_guard.mjs +5 -5
- package/build/schema/engine/_reducer.d.mts +2 -1
- package/build/schema/engine/_reducer.mjs +3 -3
- package/build/schema/engine/_refine.d.mts +4 -3
- package/build/schema/engine/_refine.mjs +4 -4
- package/build/schema/engine/_stack.d.mts +18 -0
- package/build/schema/engine/_stack.mjs +73 -0
- package/build/schema/engine/_unique.d.mts +2 -0
- package/build/schema/engine/_unique.mjs +5 -0
- package/build/schema/engine/additionalItems.d.mts +5 -4
- package/build/schema/engine/additionalItems.mjs +15 -13
- package/build/schema/engine/additionalProperties.d.mts +5 -4
- package/build/schema/engine/additionalProperties.mjs +19 -16
- package/build/schema/engine/allOf.d.mts +5 -4
- package/build/schema/engine/allOf.mjs +15 -15
- package/build/schema/engine/anyOf.d.mts +5 -4
- package/build/schema/engine/anyOf.mjs +15 -15
- package/build/schema/engine/boolean.d.mts +4 -3
- package/build/schema/engine/boolean.mjs +4 -4
- package/build/schema/engine/const.d.mts +5 -4
- package/build/schema/engine/const.mjs +6 -6
- package/build/schema/engine/contains.d.mts +5 -4
- package/build/schema/engine/contains.mjs +10 -8
- package/build/schema/engine/dependencies.d.mts +5 -4
- package/build/schema/engine/dependencies.mjs +6 -6
- package/build/schema/engine/dependentRequired.d.mts +5 -4
- package/build/schema/engine/dependentRequired.mjs +3 -3
- package/build/schema/engine/dependentSchemas.d.mts +5 -4
- package/build/schema/engine/dependentSchemas.mjs +6 -6
- package/build/schema/engine/enum.d.mts +5 -4
- package/build/schema/engine/enum.mjs +6 -6
- package/build/schema/engine/exclusiveMaximum.d.mts +5 -4
- package/build/schema/engine/exclusiveMaximum.mjs +4 -4
- package/build/schema/engine/exclusiveMinimum.d.mts +5 -4
- package/build/schema/engine/exclusiveMinimum.mjs +4 -4
- package/build/schema/engine/format.d.mts +5 -4
- package/build/schema/engine/format.mjs +5 -5
- package/build/schema/engine/if.d.mts +5 -4
- package/build/schema/engine/if.mjs +19 -19
- package/build/schema/engine/index.d.mts +12 -11
- package/build/schema/engine/index.mjs +13 -12
- package/build/schema/engine/items.d.mts +5 -4
- package/build/schema/engine/items.mjs +22 -22
- package/build/schema/engine/maxContains.d.mts +5 -4
- package/build/schema/engine/maxContains.mjs +11 -9
- package/build/schema/engine/maxItems.d.mts +5 -4
- package/build/schema/engine/maxItems.mjs +4 -4
- package/build/schema/engine/maxLength.d.mts +5 -4
- package/build/schema/engine/maxLength.mjs +4 -4
- package/build/schema/engine/maxProperties.d.mts +5 -4
- package/build/schema/engine/maxProperties.mjs +4 -4
- package/build/schema/engine/maximum.d.mts +5 -4
- package/build/schema/engine/maximum.mjs +4 -4
- package/build/schema/engine/minContains.d.mts +5 -4
- package/build/schema/engine/minContains.mjs +10 -8
- package/build/schema/engine/minItems.d.mts +5 -4
- package/build/schema/engine/minItems.mjs +4 -4
- package/build/schema/engine/minLength.d.mts +5 -4
- package/build/schema/engine/minLength.mjs +4 -4
- package/build/schema/engine/minProperties.d.mts +5 -4
- package/build/schema/engine/minProperties.mjs +4 -4
- package/build/schema/engine/minimum.d.mts +5 -4
- package/build/schema/engine/minimum.mjs +4 -4
- package/build/schema/engine/multipleOf.d.mts +5 -4
- package/build/schema/engine/multipleOf.mjs +4 -4
- package/build/schema/engine/not.d.mts +5 -4
- package/build/schema/engine/not.mjs +14 -13
- package/build/schema/engine/oneOf.d.mts +5 -4
- package/build/schema/engine/oneOf.mjs +14 -14
- package/build/schema/engine/pattern.d.mts +5 -4
- package/build/schema/engine/pattern.mjs +6 -6
- package/build/schema/engine/patternProperties.d.mts +5 -4
- package/build/schema/engine/patternProperties.mjs +14 -12
- package/build/schema/engine/prefixItems.d.mts +5 -4
- package/build/schema/engine/prefixItems.mjs +6 -6
- package/build/schema/engine/properties.d.mts +5 -4
- package/build/schema/engine/properties.mjs +10 -10
- package/build/schema/engine/propertyNames.d.mts +5 -4
- package/build/schema/engine/propertyNames.mjs +11 -9
- package/build/schema/engine/recursiveRef.d.mts +5 -4
- package/build/schema/engine/recursiveRef.mjs +11 -22
- package/build/schema/engine/ref.d.mts +5 -4
- package/build/schema/engine/ref.mjs +44 -29
- package/build/schema/engine/required.d.mts +5 -4
- package/build/schema/engine/required.mjs +3 -3
- package/build/schema/engine/schema.d.mts +5 -4
- package/build/schema/engine/schema.mjs +216 -207
- package/build/schema/engine/type.d.mts +5 -4
- package/build/schema/engine/type.mjs +12 -12
- package/build/schema/engine/unevaluatedItems.d.mts +5 -4
- package/build/schema/engine/unevaluatedItems.mjs +15 -13
- package/build/schema/engine/unevaluatedProperties.d.mts +5 -4
- package/build/schema/engine/unevaluatedProperties.mjs +15 -13
- package/build/schema/engine/uniqueItems.d.mts +5 -4
- package/build/schema/engine/uniqueItems.mjs +3 -3
- package/build/schema/errors.d.mts +3 -3
- package/build/schema/errors.mjs +4 -4
- package/build/schema/resolve/index.d.mts +1 -0
- package/build/schema/resolve/index.mjs +1 -0
- package/build/schema/resolve/ref.d.mts +2 -0
- package/build/schema/{resolver → resolve}/ref.mjs +43 -45
- package/build/schema/resolve/resolve.d.mts +1 -0
- package/build/schema/resolve/resolve.mjs +1 -0
- package/build/schema/schema.d.mts +1 -1
- package/build/schema/schema.mjs +1 -1
- package/build/schema/types/recursiveAnchor.d.mts +4 -0
- package/build/schema/types/recursiveAnchor.mjs +7 -0
- package/build/type/types/_codec.d.mts +1 -1
- package/build/type/types/_codec.mjs +1 -0
- package/build/type/types/static.d.mts +4 -4
- package/package.json +1 -1
- package/readme.md +1 -76
- package/build/schema/resolver/index.d.mts +0 -1
- package/build/schema/resolver/index.mjs +0 -1
- package/build/schema/resolver/recursiveRef.d.mts +0 -2
- package/build/schema/resolver/recursiveRef.mjs +0 -47
- package/build/schema/resolver/ref.d.mts +0 -1
- package/build/schema/resolver/resolver.d.mts +0 -2
- package/build/schema/resolver/resolver.mjs +0 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as S from '../types/index.mjs';
|
|
3
3
|
import * as V from './_externals.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { Unique } from './_unique.mjs';
|
|
5
5
|
import { AccumulatedErrorContext } from './_context.mjs';
|
|
6
|
+
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
6
7
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
7
8
|
// ------------------------------------------------------------------
|
|
8
9
|
// Common: GetPropertiesPattern
|
|
@@ -51,45 +52,47 @@ export function BuildAdditionalPropertiesFast(context, schema, value) {
|
|
|
51
52
|
// ------------------------------------------------------------------
|
|
52
53
|
// BuildAdditionalPropertiesStandard
|
|
53
54
|
// ------------------------------------------------------------------
|
|
54
|
-
export function BuildAdditionalPropertiesStandard(context, schema, value) {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
55
|
+
export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
|
|
56
|
+
const [key, _index] = [Unique(), Unique()];
|
|
57
|
+
const regexp = V.CreateVariable(new RegExp(GetPropertiesPattern(schema)));
|
|
58
|
+
const isSchema = BuildSchema(stack, context, schema.additionalProperties, `${value}[${key}]`);
|
|
59
|
+
const isKey = E.Call(E.Member(regexp, 'test'), [key]);
|
|
60
|
+
const addKey = context.AddKey(key);
|
|
59
61
|
const guarded = context.UseUnevaluated() ? E.Or(isKey, E.And(isSchema, addKey)) : E.Or(isKey, isSchema);
|
|
60
|
-
|
|
62
|
+
const result = E.Every(E.Keys(value), E.Constant(0), [key, _index], guarded);
|
|
63
|
+
return result;
|
|
61
64
|
}
|
|
62
65
|
// ------------------------------------------------------------------
|
|
63
66
|
// Build
|
|
64
67
|
// ------------------------------------------------------------------
|
|
65
|
-
export function BuildAdditionalProperties(context, schema, value) {
|
|
68
|
+
export function BuildAdditionalProperties(stack, context, schema, value) {
|
|
66
69
|
return CanAdditionalPropertiesFast(context, schema, value)
|
|
67
70
|
? BuildAdditionalPropertiesFast(context, schema, value)
|
|
68
|
-
: BuildAdditionalPropertiesStandard(context, schema, value);
|
|
71
|
+
: BuildAdditionalPropertiesStandard(stack, context, schema, value);
|
|
69
72
|
}
|
|
70
73
|
// ------------------------------------------------------------------
|
|
71
74
|
// Check
|
|
72
75
|
// ------------------------------------------------------------------
|
|
73
|
-
export function CheckAdditionalProperties(context, schema, value) {
|
|
76
|
+
export function CheckAdditionalProperties(stack, context, schema, value) {
|
|
74
77
|
const regexp = new RegExp(GetPropertiesPattern(schema));
|
|
75
|
-
const isAdditionalProperties = G.Every(G.Keys(value), 0, (key) => {
|
|
78
|
+
const isAdditionalProperties = G.Every(G.Keys(value), 0, (key, _index) => {
|
|
76
79
|
return regexp.test(key) ||
|
|
77
|
-
(CheckSchema(context, schema.additionalProperties, value[key]) && context.AddKey(key));
|
|
80
|
+
(CheckSchema(stack, context, schema.additionalProperties, value[key]) && context.AddKey(key));
|
|
78
81
|
});
|
|
79
82
|
return isAdditionalProperties;
|
|
80
83
|
}
|
|
81
84
|
// ------------------------------------------------------------------
|
|
82
85
|
// Error
|
|
83
86
|
// ------------------------------------------------------------------
|
|
84
|
-
export function ErrorAdditionalProperties(context, schemaPath, instancePath, schema, value) {
|
|
87
|
+
export function ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
85
88
|
const regexp = new RegExp(GetPropertiesPattern(schema));
|
|
86
89
|
const additionalProperties = [];
|
|
87
|
-
const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key) => {
|
|
90
|
+
const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key, _index) => {
|
|
88
91
|
const nextSchemaPath = `${schemaPath}/additionalProperties`;
|
|
89
92
|
const nextInstancePath = `${instancePath}/${key}`;
|
|
90
|
-
const nextContext = new AccumulatedErrorContext(
|
|
93
|
+
const nextContext = new AccumulatedErrorContext();
|
|
91
94
|
const isAdditionalProperty = regexp.test(key) ||
|
|
92
|
-
(ErrorSchema(nextContext, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key));
|
|
95
|
+
(ErrorSchema(stack, nextContext, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key));
|
|
93
96
|
if (!isAdditionalProperty)
|
|
94
97
|
additionalProperties.push(key);
|
|
95
98
|
return isAdditionalProperty;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildAllOf(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckAllOf(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorAllOf(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildAllOf(stack: Stack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
|
|
5
|
+
export declare function CheckAllOf(stack: Stack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorAllOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
+
import { CheckContext, AccumulatedErrorContext } from './_context.mjs';
|
|
3
|
+
import { Reducer } from './_reducer.mjs';
|
|
2
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
3
|
-
import { AccumulatedErrorContext } from './_context.mjs';
|
|
4
5
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
|
-
import { Reducer } from './_reducer.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
9
|
-
function BuildAllOfStandard(context, schema, value) {
|
|
10
|
-
return Reducer(context, schema.allOf, value, E.IsEqual(E.Member('results', 'length'), E.Constant(schema.allOf.length)));
|
|
9
|
+
function BuildAllOfStandard(stack, context, schema, value) {
|
|
10
|
+
return Reducer(stack, context, schema.allOf, value, E.IsEqual(E.Member('results', 'length'), E.Constant(schema.allOf.length)));
|
|
11
11
|
}
|
|
12
|
-
function BuildAllOfFast(context, schema, value) {
|
|
13
|
-
return E.ReduceAnd(schema.allOf.map((schema) => BuildSchema(context, schema, value)));
|
|
12
|
+
function BuildAllOfFast(stack, context, schema, value) {
|
|
13
|
+
return E.ReduceAnd(schema.allOf.map((schema) => BuildSchema(stack, context, schema, value)));
|
|
14
14
|
}
|
|
15
|
-
export function BuildAllOf(context, schema, value) {
|
|
15
|
+
export function BuildAllOf(stack, context, schema, value) {
|
|
16
16
|
return context.UseUnevaluated()
|
|
17
|
-
? BuildAllOfStandard(context, schema, value)
|
|
18
|
-
: BuildAllOfFast(context, schema, value);
|
|
17
|
+
? BuildAllOfStandard(stack, context, schema, value)
|
|
18
|
+
: BuildAllOfFast(stack, context, schema, value);
|
|
19
19
|
}
|
|
20
20
|
// ------------------------------------------------------------------
|
|
21
21
|
// Check
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
|
-
export function CheckAllOf(context, schema, value) {
|
|
23
|
+
export function CheckAllOf(stack, context, schema, value) {
|
|
24
24
|
const results = schema.allOf.reduce((result, schema) => {
|
|
25
|
-
const nextContext =
|
|
26
|
-
return CheckSchema(nextContext, schema, value) ? [...result, nextContext] : result;
|
|
25
|
+
const nextContext = new CheckContext();
|
|
26
|
+
return CheckSchema(stack, nextContext, schema, value) ? [...result, nextContext] : result;
|
|
27
27
|
}, []);
|
|
28
28
|
return G.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
|
|
29
29
|
}
|
|
30
30
|
// ------------------------------------------------------------------
|
|
31
31
|
// Error
|
|
32
32
|
// ------------------------------------------------------------------
|
|
33
|
-
export function ErrorAllOf(context, schemaPath, instancePath, schema, value) {
|
|
33
|
+
export function ErrorAllOf(stack, context, schemaPath, instancePath, schema, value) {
|
|
34
34
|
const failedContexts = [];
|
|
35
35
|
const results = schema.allOf.reduce((result, schema, index) => {
|
|
36
36
|
const nextSchemaPath = `${schemaPath}/allOf/${index}`;
|
|
37
|
-
const nextContext = new AccumulatedErrorContext(
|
|
38
|
-
const isSchema = ErrorSchema(nextContext, nextSchemaPath, instancePath, schema, value);
|
|
37
|
+
const nextContext = new AccumulatedErrorContext();
|
|
38
|
+
const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema, value);
|
|
39
39
|
if (!isSchema)
|
|
40
40
|
failedContexts.push(nextContext);
|
|
41
41
|
return isSchema ? [...result, nextContext] : result;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildAnyOf(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckAnyOf(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorAnyOf(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildAnyOf(stack: Stack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
|
|
5
|
+
export declare function CheckAnyOf(stack: Stack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorAnyOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
+
import { CheckContext, AccumulatedErrorContext } from './_context.mjs';
|
|
3
|
+
import { Reducer } from './_reducer.mjs';
|
|
2
4
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
3
|
-
import { AccumulatedErrorContext } from './_context.mjs';
|
|
4
5
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
|
-
import { Reducer } from './_reducer.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
9
|
-
function BuildAnyOfStandard(context, schema, value) {
|
|
10
|
-
return Reducer(context, schema.anyOf, value, E.IsGreaterThan(E.Member('results', 'length'), E.Constant(0)));
|
|
9
|
+
function BuildAnyOfStandard(stack, context, schema, value) {
|
|
10
|
+
return Reducer(stack, context, schema.anyOf, value, E.IsGreaterThan(E.Member('results', 'length'), E.Constant(0)));
|
|
11
11
|
}
|
|
12
|
-
function BuildAnyOfFast(context, schema, value) {
|
|
13
|
-
return E.ReduceOr(schema.anyOf.map((schema) => BuildSchema(context, schema, value)));
|
|
12
|
+
function BuildAnyOfFast(stack, context, schema, value) {
|
|
13
|
+
return E.ReduceOr(schema.anyOf.map((schema) => BuildSchema(stack, context, schema, value)));
|
|
14
14
|
}
|
|
15
|
-
export function BuildAnyOf(context, schema, value) {
|
|
15
|
+
export function BuildAnyOf(stack, context, schema, value) {
|
|
16
16
|
return context.UseUnevaluated()
|
|
17
|
-
? BuildAnyOfStandard(context, schema, value)
|
|
18
|
-
: BuildAnyOfFast(context, schema, value);
|
|
17
|
+
? BuildAnyOfStandard(stack, context, schema, value)
|
|
18
|
+
: BuildAnyOfFast(stack, context, schema, value);
|
|
19
19
|
}
|
|
20
20
|
// ------------------------------------------------------------------
|
|
21
21
|
// Check
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
|
-
export function CheckAnyOf(context, schema, value) {
|
|
23
|
+
export function CheckAnyOf(stack, context, schema, value) {
|
|
24
24
|
const results = schema.anyOf.reduce((result, schema, index) => {
|
|
25
|
-
const nextContext =
|
|
26
|
-
return CheckSchema(nextContext, schema, value) ? [...result, nextContext] : result;
|
|
25
|
+
const nextContext = new CheckContext();
|
|
26
|
+
return CheckSchema(stack, nextContext, schema, value) ? [...result, nextContext] : result;
|
|
27
27
|
}, []);
|
|
28
28
|
return G.IsGreaterThan(results.length, 0) && context.Merge(results);
|
|
29
29
|
}
|
|
30
30
|
// ------------------------------------------------------------------
|
|
31
31
|
// Error
|
|
32
32
|
// ------------------------------------------------------------------
|
|
33
|
-
export function ErrorAnyOf(context, schemaPath, instancePath, schema, value) {
|
|
33
|
+
export function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, value) {
|
|
34
34
|
const failedContexts = [];
|
|
35
35
|
const results = schema.anyOf.reduce((result, schema, index) => {
|
|
36
|
-
const nextContext = new AccumulatedErrorContext(
|
|
36
|
+
const nextContext = new AccumulatedErrorContext();
|
|
37
37
|
const nextSchemaPath = `${schemaPath}/anyOf/${index}`;
|
|
38
|
-
const isSchema = ErrorSchema(nextContext, nextSchemaPath, instancePath, schema, value);
|
|
38
|
+
const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema, value);
|
|
39
39
|
if (!isSchema)
|
|
40
40
|
failedContexts.push(nextContext);
|
|
41
41
|
return isSchema ? [...result, nextContext] : result;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Stack } from './_stack.mjs';
|
|
1
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
2
|
-
export declare function BuildBooleanSchema(context: BuildContext, schema: boolean, value: string): string;
|
|
3
|
-
export declare function CheckBooleanSchema(context: CheckContext, schema: boolean, value: unknown): boolean;
|
|
4
|
-
export declare function ErrorBooleanSchema(context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
|
|
3
|
+
export declare function BuildBooleanSchema(stack: Stack, context: BuildContext, schema: boolean, value: string): string;
|
|
4
|
+
export declare function CheckBooleanSchema(stack: Stack, context: CheckContext, schema: boolean, value: unknown): boolean;
|
|
5
|
+
export declare function ErrorBooleanSchema(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
|
|
@@ -3,20 +3,20 @@ import { EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildBooleanSchema(context, schema, value) {
|
|
6
|
+
export function BuildBooleanSchema(stack, context, schema, value) {
|
|
7
7
|
return schema ? E.Constant(true) : E.Constant(false);
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckBooleanSchema(context, schema, value) {
|
|
12
|
+
export function CheckBooleanSchema(stack, context, schema, value) {
|
|
13
13
|
return schema;
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
|
-
export function ErrorBooleanSchema(context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckBooleanSchema(context, schema, value) || context.AddError({
|
|
18
|
+
export function ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
+
return CheckBooleanSchema(stack, context, schema, value) || context.AddError({
|
|
20
20
|
keyword: 'boolean',
|
|
21
21
|
schemaPath,
|
|
22
22
|
instancePath,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildConst(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckConst(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorConst(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildConst(stack: Stack, context: BuildContext, schema: Schema.XConst, value: string): string;
|
|
5
|
+
export declare function CheckConst(stack: Stack, context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorConst(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as
|
|
2
|
+
import * as Externals from './_externals.mjs';
|
|
3
3
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildConst(context, schema, value) {
|
|
7
|
+
export function BuildConst(stack, context, schema, value) {
|
|
8
8
|
return G.IsValueLike(schema.const)
|
|
9
9
|
? E.IsEqual(value, E.Constant(schema.const))
|
|
10
|
-
: E.IsDeepEqual(value,
|
|
10
|
+
: E.IsDeepEqual(value, Externals.CreateVariable(schema.const));
|
|
11
11
|
}
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
// Check
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
|
-
export function CheckConst(context, schema, value) {
|
|
15
|
+
export function CheckConst(stack, context, schema, value) {
|
|
16
16
|
return G.IsValueLike(schema.const)
|
|
17
17
|
? G.IsEqual(value, schema.const)
|
|
18
18
|
: G.IsDeepEqual(value, schema.const);
|
|
@@ -20,8 +20,8 @@ export function CheckConst(context, schema, value) {
|
|
|
20
20
|
// ------------------------------------------------------------------
|
|
21
21
|
// Check
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
|
-
export function ErrorConst(context, schemaPath, instancePath, schema, value) {
|
|
24
|
-
return CheckConst(context, schema, value) || context.AddError({
|
|
23
|
+
export function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
|
|
24
|
+
return CheckConst(stack, context, schema, value) || context.AddError({
|
|
25
25
|
keyword: 'const',
|
|
26
26
|
schemaPath,
|
|
27
27
|
instancePath,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildContains(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckContains(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorContains(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildContains(stack: Stack, context: BuildContext, schema: Schema.XContains, value: string): string;
|
|
5
|
+
export declare function CheckContains(stack: Stack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as
|
|
2
|
+
import * as Schema from '../types/index.mjs';
|
|
3
|
+
import { Unique } from './_unique.mjs';
|
|
3
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
4
5
|
import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
5
6
|
// ------------------------------------------------------------------
|
|
6
7
|
// Invalid
|
|
7
8
|
// ------------------------------------------------------------------
|
|
8
9
|
function IsValid(schema) {
|
|
9
|
-
return !(
|
|
10
|
+
return !(Schema.IsMinContains(schema) && G.IsEqual(schema.minContains, 0));
|
|
10
11
|
}
|
|
11
12
|
// ------------------------------------------------------------------
|
|
12
13
|
// Build
|
|
13
14
|
// ------------------------------------------------------------------
|
|
14
|
-
export function BuildContains(context, schema, value) {
|
|
15
|
+
export function BuildContains(stack, context, schema, value) {
|
|
15
16
|
if (!IsValid(schema))
|
|
16
17
|
return E.Constant(true);
|
|
18
|
+
const item = Unique();
|
|
17
19
|
const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
|
|
18
|
-
const isSome = E.Call(E.Member(value, 'some'), [E.ArrowFunction([
|
|
20
|
+
const isSome = E.Call(E.Member(value, 'some'), [E.ArrowFunction([item], BuildSchema(stack, context, schema.contains, item))]);
|
|
19
21
|
return E.And(isLength, isSome);
|
|
20
22
|
}
|
|
21
23
|
// ------------------------------------------------------------------
|
|
22
24
|
// Check
|
|
23
25
|
// ------------------------------------------------------------------
|
|
24
|
-
export function CheckContains(context, schema, value) {
|
|
26
|
+
export function CheckContains(stack, context, schema, value) {
|
|
25
27
|
if (!IsValid(schema))
|
|
26
28
|
return true;
|
|
27
29
|
return !G.IsEqual(value.length, 0) &&
|
|
28
|
-
value.some((
|
|
30
|
+
value.some((item) => CheckSchema(stack, context, schema.contains, item));
|
|
29
31
|
}
|
|
30
32
|
// ------------------------------------------------------------------
|
|
31
33
|
// Error
|
|
32
34
|
// ------------------------------------------------------------------
|
|
33
|
-
export function ErrorContains(context, schemaPath, instancePath, schema, value) {
|
|
34
|
-
return CheckContains(context, schema, value) || context.AddError({
|
|
35
|
+
export function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
|
|
36
|
+
return CheckContains(stack, context, schema, value) || context.AddError({
|
|
35
37
|
keyword: 'contains',
|
|
36
38
|
schemaPath,
|
|
37
39
|
instancePath,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildDependencies(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckDependencies(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorDependencies(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildDependencies(stack: Stack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
|
|
5
|
+
export declare function CheckDependencies(stack: Stack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependencies(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -4,11 +4,11 @@ import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildDependencies(context, schema, value) {
|
|
7
|
+
export function BuildDependencies(stack, context, schema, value) {
|
|
8
8
|
const isLength = E.IsEqual(E.Member(E.Keys(value), 'length'), E.Constant(0));
|
|
9
9
|
const isEveryDependency = E.ReduceAnd(G.Entries(schema.dependencies).map(([key, schema]) => {
|
|
10
10
|
const notKey = E.Not(E.HasPropertyKey(value, E.Constant(key)));
|
|
11
|
-
const isSchema = BuildSchema(context, schema, value);
|
|
11
|
+
const isSchema = BuildSchema(stack, context, schema, value);
|
|
12
12
|
const isEveryKey = (schema) => E.ReduceAnd(schema.map((key) => E.HasPropertyKey(value, E.Constant(key))));
|
|
13
13
|
return E.Or(notKey, G.IsArray(schema) ? isEveryKey(schema) : isSchema);
|
|
14
14
|
}));
|
|
@@ -17,19 +17,19 @@ export function BuildDependencies(context, schema, value) {
|
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
// Check
|
|
19
19
|
// ------------------------------------------------------------------
|
|
20
|
-
export function CheckDependencies(context, schema, value) {
|
|
20
|
+
export function CheckDependencies(stack, context, schema, value) {
|
|
21
21
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
22
22
|
const isEvery = G.Every(G.Entries(schema.dependencies), 0, ([key, schema]) => {
|
|
23
23
|
return !G.HasPropertyKey(value, key) || (G.IsArray(schema)
|
|
24
24
|
? schema.every((key) => G.HasPropertyKey(value, key))
|
|
25
|
-
: CheckSchema(context, schema, value));
|
|
25
|
+
: CheckSchema(stack, context, schema, value));
|
|
26
26
|
});
|
|
27
27
|
return isLength || isEvery;
|
|
28
28
|
}
|
|
29
29
|
// ------------------------------------------------------------------
|
|
30
30
|
// Error
|
|
31
31
|
// ------------------------------------------------------------------
|
|
32
|
-
export function ErrorDependencies(context, schemaPath, instancePath, schema, value) {
|
|
32
|
+
export function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
|
|
33
33
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
34
34
|
const isEvery = G.EveryAll(G.Entries(schema.dependencies), 0, ([key, schema]) => {
|
|
35
35
|
const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
|
|
@@ -39,7 +39,7 @@ export function ErrorDependencies(context, schemaPath, instancePath, schema, val
|
|
|
39
39
|
schemaPath,
|
|
40
40
|
instancePath,
|
|
41
41
|
params: { property: key, dependencies: schema },
|
|
42
|
-
})) : ErrorSchema(context, nextSchemaPath, instancePath, schema, value));
|
|
42
|
+
})) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
|
|
43
43
|
});
|
|
44
44
|
return isLength || isEvery;
|
|
45
45
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildDependentRequired(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckDependentRequired(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorDependentRequired(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildDependentRequired(stack: Stack, context: BuildContext, schema: Schema.XDependentRequired, value: string): string;
|
|
5
|
+
export declare function CheckDependentRequired(stack: Stack, context: CheckContext, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependentRequired(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -3,7 +3,7 @@ import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildDependentRequired(context, schema, value) {
|
|
6
|
+
export function BuildDependentRequired(stack, context, schema, value) {
|
|
7
7
|
const isLength = E.IsEqual(E.Member(E.Keys(value), 'length'), E.Constant(0));
|
|
8
8
|
const isEvery = E.ReduceAnd(G.Entries(schema.dependentRequired).map(([key, keys]) => {
|
|
9
9
|
const notKey = E.Not(E.HasPropertyKey(value, E.Constant(key)));
|
|
@@ -15,7 +15,7 @@ export function BuildDependentRequired(context, schema, value) {
|
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
|
-
export function CheckDependentRequired(context, schema, value) {
|
|
18
|
+
export function CheckDependentRequired(stack, context, schema, value) {
|
|
19
19
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
20
20
|
const isEvery = G.Every(G.Entries(schema.dependentRequired), 0, ([key, keys]) => {
|
|
21
21
|
return !G.HasPropertyKey(value, key) ||
|
|
@@ -26,7 +26,7 @@ export function CheckDependentRequired(context, schema, value) {
|
|
|
26
26
|
// ------------------------------------------------------------------
|
|
27
27
|
// Error
|
|
28
28
|
// ------------------------------------------------------------------
|
|
29
|
-
export function ErrorDependentRequired(context, schemaPath, instancePath, schema, value) {
|
|
29
|
+
export function ErrorDependentRequired(stack, context, schemaPath, instancePath, schema, value) {
|
|
30
30
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
31
31
|
const isEveryEntry = G.EveryAll(G.Entries(schema.dependentRequired), 0, ([key, keys]) => {
|
|
32
32
|
return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildDependentSchemas(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckDependentSchemas(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorDependentSchemas(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildDependentSchemas(stack: Stack, context: BuildContext, schema: Schema.XDependentSchemas, value: string): string;
|
|
5
|
+
export declare function CheckDependentSchemas(stack: Stack, context: CheckContext, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependentSchemas(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -4,11 +4,11 @@ import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildDependentSchemas(context, schema, value) {
|
|
7
|
+
export function BuildDependentSchemas(stack, context, schema, value) {
|
|
8
8
|
const isLength = E.IsEqual(E.Member(E.Keys(value), 'length'), E.Constant(0));
|
|
9
9
|
const isEvery = E.ReduceAnd(G.Entries(schema.dependentSchemas).map(([key, schema]) => {
|
|
10
10
|
const notKey = E.Not(E.HasPropertyKey(value, E.Constant(key)));
|
|
11
|
-
const isSchema = BuildSchema(context, schema, value);
|
|
11
|
+
const isSchema = BuildSchema(stack, context, schema, value);
|
|
12
12
|
return E.Or(notKey, isSchema);
|
|
13
13
|
}));
|
|
14
14
|
return E.Or(isLength, isEvery);
|
|
@@ -16,23 +16,23 @@ export function BuildDependentSchemas(context, schema, value) {
|
|
|
16
16
|
// ------------------------------------------------------------------
|
|
17
17
|
// Check
|
|
18
18
|
// ------------------------------------------------------------------
|
|
19
|
-
export function CheckDependentSchemas(context, schema, value) {
|
|
19
|
+
export function CheckDependentSchemas(stack, context, schema, value) {
|
|
20
20
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
21
21
|
const isEvery = G.Every(G.Entries(schema.dependentSchemas), 0, ([key, schema]) => {
|
|
22
22
|
return !G.HasPropertyKey(value, key) ||
|
|
23
|
-
CheckSchema(context, schema, value);
|
|
23
|
+
CheckSchema(stack, context, schema, value);
|
|
24
24
|
});
|
|
25
25
|
return isLength || isEvery;
|
|
26
26
|
}
|
|
27
27
|
// ------------------------------------------------------------------
|
|
28
28
|
// Error
|
|
29
29
|
// ------------------------------------------------------------------
|
|
30
|
-
export function ErrorDependentSchemas(context, schemaPath, instancePath, schema, value) {
|
|
30
|
+
export function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
|
|
31
31
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
32
32
|
const isEvery = G.EveryAll(G.Entries(schema.dependentSchemas), 0, ([key, schema]) => {
|
|
33
33
|
const nextSchemaPath = `${schemaPath}/dependentSchemas/${key}`;
|
|
34
34
|
return !G.HasPropertyKey(value, key) ||
|
|
35
|
-
ErrorSchema(context, nextSchemaPath, instancePath, schema, value);
|
|
35
|
+
ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value);
|
|
36
36
|
});
|
|
37
37
|
return isLength || isEvery;
|
|
38
38
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildEnum(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckEnum(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorEnum(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildEnum(stack: Stack, context: BuildContext, schema: Schema.XEnum, value: string): string;
|
|
5
|
+
export declare function CheckEnum(stack: Stack, context: CheckContext, schema: Schema.XEnum, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorEnum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XEnum, value: unknown): boolean;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as
|
|
2
|
+
import * as Externals from './_externals.mjs';
|
|
3
3
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildEnum(context, schema, value) {
|
|
7
|
+
export function BuildEnum(stack, context, schema, value) {
|
|
8
8
|
return E.ReduceOr(schema.enum.map(option => {
|
|
9
9
|
if (G.IsValueLike(option))
|
|
10
10
|
return E.IsEqual(value, E.Constant(option));
|
|
11
|
-
const variable =
|
|
11
|
+
const variable = Externals.CreateVariable(option);
|
|
12
12
|
return E.IsDeepEqual(value, variable);
|
|
13
13
|
}));
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
|
-
export function CheckEnum(context, schema, value) {
|
|
18
|
+
export function CheckEnum(stack, context, schema, value) {
|
|
19
19
|
return schema.enum.some(option => G.IsValueLike(option)
|
|
20
20
|
? G.IsEqual(value, option)
|
|
21
21
|
: G.IsDeepEqual(value, option));
|
|
@@ -23,8 +23,8 @@ export function CheckEnum(context, schema, value) {
|
|
|
23
23
|
// ------------------------------------------------------------------
|
|
24
24
|
// Error
|
|
25
25
|
// ------------------------------------------------------------------
|
|
26
|
-
export function ErrorEnum(context, schemaPath, instancePath, schema, value) {
|
|
27
|
-
return CheckEnum(context, schema, value) || context.AddError({
|
|
26
|
+
export function ErrorEnum(stack, context, schemaPath, instancePath, schema, value) {
|
|
27
|
+
return CheckEnum(stack, context, schema, value) || context.AddError({
|
|
28
28
|
keyword: 'enum',
|
|
29
29
|
schemaPath,
|
|
30
30
|
instancePath,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildExclusiveMaximum(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckExclusiveMaximum(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorExclusiveMaximum(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildExclusiveMaximum(stack: Stack, context: BuildContext, schema: Schema.XExclusiveMaximum, value: string): string;
|
|
5
|
+
export declare function CheckExclusiveMaximum(stack: Stack, context: CheckContext, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorExclusiveMaximum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
@@ -3,20 +3,20 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildExclusiveMaximum(context, schema, value) {
|
|
6
|
+
export function BuildExclusiveMaximum(stack, context, schema, value) {
|
|
7
7
|
return E.IsLessThan(value, E.Constant(schema.exclusiveMaximum));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckExclusiveMaximum(context, schema, value) {
|
|
12
|
+
export function CheckExclusiveMaximum(stack, context, schema, value) {
|
|
13
13
|
return G.IsLessThan(value, schema.exclusiveMaximum);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
|
-
export function ErrorExclusiveMaximum(context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckExclusiveMaximum(context, schema, value) || context.AddError({
|
|
18
|
+
export function ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
+
return CheckExclusiveMaximum(stack, context, schema, value) || context.AddError({
|
|
20
20
|
keyword: 'exclusiveMaximum',
|
|
21
21
|
schemaPath,
|
|
22
22
|
instancePath,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
2
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildExclusiveMinimum(context: BuildContext, schema:
|
|
4
|
-
export declare function CheckExclusiveMinimum(context: CheckContext, schema:
|
|
5
|
-
export declare function ErrorExclusiveMinimum(context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function BuildExclusiveMinimum(stack: Stack, context: BuildContext, schema: Schema.XExclusiveMinimum, value: string): string;
|
|
5
|
+
export declare function CheckExclusiveMinimum(stack: Stack, context: CheckContext, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorExclusiveMinimum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|