@depup/typebox 1.3.27-depup.0 → 1.3.30-depup.0
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 +2 -2
- package/build/schema/build.mjs +2 -2
- package/build/schema/check.mjs +1 -1
- package/build/schema/engine/_context.d.mts +5 -1
- package/build/schema/engine/_context.mjs +16 -3
- package/build/schema/engine/_functions.d.mts +2 -2
- package/build/schema/engine/_functions.mjs +1 -1
- package/build/schema/engine/_reducer.d.mts +3 -3
- package/build/schema/engine/_refine.d.mts +5 -5
- package/build/schema/engine/_refine.mjs +4 -7
- package/build/schema/engine/_stack.d.mts +34 -20
- package/build/schema/engine/_stack.mjs +143 -202
- package/build/schema/engine/additionalItems.d.mts +4 -4
- package/build/schema/engine/additionalProperties.d.mts +8 -8
- package/build/schema/engine/additionalProperties.mjs +10 -14
- package/build/schema/engine/allOf.d.mts +4 -4
- package/build/schema/engine/allOf.mjs +1 -1
- package/build/schema/engine/anyOf.d.mts +4 -4
- package/build/schema/engine/anyOf.mjs +4 -9
- package/build/schema/engine/boolean.d.mts +4 -4
- package/build/schema/engine/boolean.mjs +2 -6
- package/build/schema/engine/const.d.mts +4 -4
- package/build/schema/engine/const.mjs +2 -6
- package/build/schema/engine/contains.d.mts +4 -4
- package/build/schema/engine/contains.mjs +2 -6
- package/build/schema/engine/dependencies.d.mts +4 -4
- package/build/schema/engine/dependencies.mjs +3 -6
- package/build/schema/engine/dependentRequired.d.mts +4 -4
- package/build/schema/engine/dependentRequired.mjs +2 -6
- package/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/build/schema/engine/dynamicRef.d.mts +4 -4
- package/build/schema/engine/dynamicRef.mjs +11 -7
- package/build/schema/engine/enum.d.mts +4 -4
- package/build/schema/engine/enum.mjs +2 -6
- package/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/build/schema/engine/format.d.mts +4 -4
- package/build/schema/engine/format.mjs +2 -6
- package/build/schema/engine/if.d.mts +4 -4
- package/build/schema/engine/if.mjs +5 -13
- package/build/schema/engine/items.d.mts +4 -4
- package/build/schema/engine/items.mjs +1 -1
- package/build/schema/engine/maxContains.d.mts +4 -4
- package/build/schema/engine/maxContains.mjs +2 -6
- package/build/schema/engine/maxItems.d.mts +4 -4
- package/build/schema/engine/maxItems.mjs +2 -6
- package/build/schema/engine/maxLength.d.mts +4 -4
- package/build/schema/engine/maxLength.mjs +2 -6
- package/build/schema/engine/maxProperties.d.mts +4 -4
- package/build/schema/engine/maxProperties.mjs +2 -6
- package/build/schema/engine/maximum.d.mts +4 -4
- package/build/schema/engine/maximum.mjs +2 -6
- package/build/schema/engine/minContains.d.mts +4 -4
- package/build/schema/engine/minContains.mjs +2 -6
- package/build/schema/engine/minItems.d.mts +5 -5
- package/build/schema/engine/minItems.mjs +2 -6
- package/build/schema/engine/minLength.d.mts +4 -4
- package/build/schema/engine/minLength.mjs +2 -6
- package/build/schema/engine/minProperties.d.mts +4 -4
- package/build/schema/engine/minProperties.mjs +2 -6
- package/build/schema/engine/minimum.d.mts +4 -4
- package/build/schema/engine/minimum.mjs +2 -6
- package/build/schema/engine/multipleOf.d.mts +4 -4
- package/build/schema/engine/multipleOf.mjs +2 -6
- package/build/schema/engine/not.d.mts +4 -4
- package/build/schema/engine/not.mjs +4 -8
- package/build/schema/engine/oneOf.d.mts +4 -4
- package/build/schema/engine/oneOf.mjs +5 -10
- package/build/schema/engine/pattern.d.mts +4 -4
- package/build/schema/engine/pattern.mjs +3 -7
- package/build/schema/engine/patternProperties.d.mts +4 -4
- package/build/schema/engine/patternProperties.mjs +1 -1
- package/build/schema/engine/prefixItems.d.mts +4 -4
- package/build/schema/engine/prefixItems.mjs +1 -1
- package/build/schema/engine/properties.d.mts +4 -4
- package/build/schema/engine/properties.mjs +1 -1
- package/build/schema/engine/propertyNames.d.mts +4 -4
- package/build/schema/engine/propertyNames.mjs +3 -7
- package/build/schema/engine/recursiveRef.d.mts +4 -4
- package/build/schema/engine/recursiveRef.mjs +11 -7
- package/build/schema/engine/ref.d.mts +4 -4
- package/build/schema/engine/ref.mjs +17 -13
- package/build/schema/engine/required.d.mts +4 -4
- package/build/schema/engine/required.mjs +2 -6
- package/build/schema/engine/schema.d.mts +7 -7
- package/build/schema/engine/schema.mjs +131 -133
- package/build/schema/engine/type.d.mts +4 -4
- package/build/schema/engine/type.mjs +2 -6
- package/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/build/schema/engine/unevaluatedItems.mjs +3 -7
- package/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/build/schema/engine/unevaluatedProperties.mjs +3 -7
- package/build/schema/engine/uniqueItems.d.mts +4 -4
- package/build/schema/engine/uniqueItems.mjs +2 -6
- package/build/schema/errors.mjs +1 -1
- package/build/schema/intern/intern.d.mts +6 -9
- package/build/schema/intern/intern.mjs +90 -56
- package/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/build/schema/meta/draft_2019_09.mjs +288 -0
- package/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/build/schema/meta/draft_2020_12.mjs +300 -0
- package/build/schema/meta/draft_3.d.mts +2 -0
- package/build/schema/meta/draft_3.mjs +143 -0
- package/build/schema/meta/draft_4.d.mts +2 -0
- package/build/schema/meta/draft_4.mjs +149 -0
- package/build/schema/meta/draft_6.d.mts +2 -0
- package/build/schema/meta/draft_6.mjs +155 -0
- package/build/schema/meta/draft_7.d.mts +2 -0
- package/build/schema/meta/draft_7.mjs +172 -0
- package/build/schema/meta/index.d.mts +2 -0
- package/build/schema/meta/index.mjs +2 -0
- package/build/schema/meta/meta.d.mts +9 -0
- package/build/schema/meta/meta.mjs +15 -0
- package/build/schema/meta/schema.d.mts +6 -0
- package/build/schema/meta/schema.mjs +1 -0
- package/build/schema/resolve/resolve.d.mts +6 -32
- package/build/schema/resolve/resolve.mjs +231 -227
- package/build/schema/schema.d.mts +1 -0
- package/build/schema/schema.mjs +1 -0
- package/changes.json +1 -1
- package/package.json +3 -3
- package/readme.md +51 -85
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as Schema from '../types/index.mjs';
|
|
3
|
+
import * as Externals from './_externals.mjs';
|
|
4
4
|
import { Unique } from './_unique.mjs';
|
|
5
5
|
import { UnicodeRegExp } from './_regexp.mjs';
|
|
6
6
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
@@ -34,9 +34,9 @@ function GetPropertyKeyAsPattern(key) {
|
|
|
34
34
|
}
|
|
35
35
|
function GetPropertiesPattern(schema) {
|
|
36
36
|
const patterns = [];
|
|
37
|
-
if (
|
|
37
|
+
if (Schema.IsPatternProperties(schema))
|
|
38
38
|
patterns.push(...G.Keys(schema.patternProperties));
|
|
39
|
-
if (
|
|
39
|
+
if (Schema.IsProperties(schema))
|
|
40
40
|
patterns.push(...G.Keys(schema.properties).map(GetPropertyKeyAsPattern));
|
|
41
41
|
return G.IsEqual(patterns.length, 0) ? '(?!)' : `(${patterns.join('|')})`;
|
|
42
42
|
}
|
|
@@ -56,9 +56,9 @@ function GetPropertiesPattern(schema) {
|
|
|
56
56
|
//
|
|
57
57
|
// ------------------------------------------------------------------
|
|
58
58
|
export function CanAdditionalPropertiesFast(_context, schema, _value) {
|
|
59
|
-
return
|
|
60
|
-
&&
|
|
61
|
-
&& !
|
|
59
|
+
return Schema.IsRequired(schema)
|
|
60
|
+
&& Schema.IsProperties(schema)
|
|
61
|
+
&& !Schema.IsPatternProperties(schema)
|
|
62
62
|
&& G.IsEqual(schema.additionalProperties, false)
|
|
63
63
|
&& G.IsEqual(G.Keys(schema.properties).length, schema.required.length);
|
|
64
64
|
}
|
|
@@ -70,7 +70,7 @@ export function BuildAdditionalPropertiesFast(_context, schema, value) {
|
|
|
70
70
|
// ------------------------------------------------------------------
|
|
71
71
|
export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
|
|
72
72
|
const [key, _index] = [Unique(), Unique()];
|
|
73
|
-
const regexp =
|
|
73
|
+
const regexp = Externals.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
|
|
74
74
|
const isSchema = BuildSchemaPushStack(stack, context, schema.additionalProperties, `${value}[${key}]`);
|
|
75
75
|
const isKey = E.Call(E.Member(regexp, 'test'), [key]);
|
|
76
76
|
const addKey = context.AddKey(key);
|
|
@@ -114,10 +114,6 @@ export function ErrorAdditionalProperties(stack, context, schemaPath, instancePa
|
|
|
114
114
|
additionalProperties.push(key);
|
|
115
115
|
return isAdditionalProperty;
|
|
116
116
|
});
|
|
117
|
-
return isAdditionalProperties ||
|
|
118
|
-
|
|
119
|
-
schemaPath,
|
|
120
|
-
instancePath,
|
|
121
|
-
params: { additionalProperties },
|
|
122
|
-
});
|
|
117
|
+
return isAdditionalProperties ||
|
|
118
|
+
context.AddError('additionalProperties', schemaPath, instancePath, { additionalProperties });
|
|
123
119
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildAllOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
|
|
5
|
+
export declare function CheckAllOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorAllOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
|
|
@@ -42,6 +42,6 @@ export function ErrorAllOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
42
42
|
}, []);
|
|
43
43
|
const isAllOf = G.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
|
|
44
44
|
if (!isAllOf)
|
|
45
|
-
failedContexts.forEach(failed => failed.GetErrors()
|
|
45
|
+
failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
|
|
46
46
|
return isAllOf;
|
|
47
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildAnyOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
|
|
5
|
+
export declare function CheckAnyOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorAnyOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
3
2
|
import { Reducer } from './_reducer.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
5
4
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
|
+
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
@@ -42,11 +42,6 @@ export function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
42
42
|
}, []);
|
|
43
43
|
const isAnyOf = G.IsGreaterThan(results.length, 0) && context.Merge(results);
|
|
44
44
|
if (!isAnyOf)
|
|
45
|
-
failedContexts.forEach(failed => failed.GetErrors()
|
|
46
|
-
return isAnyOf || context.AddError({
|
|
47
|
-
keyword: 'anyOf',
|
|
48
|
-
schemaPath,
|
|
49
|
-
instancePath,
|
|
50
|
-
params: {}
|
|
51
|
-
});
|
|
45
|
+
failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
|
|
46
|
+
return isAnyOf || context.AddError('anyOf', schemaPath, instancePath, {});
|
|
52
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Stack from './_stack.mjs';
|
|
2
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildSchemaBoolean(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
|
|
4
|
-
export declare function CheckSchemaBoolean(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
|
|
5
|
-
export declare function ErrorSchemaBoolean(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
|
|
3
|
+
export declare function BuildSchemaBoolean(_stack: Stack.XStack, _context: BuildContext, schema: boolean, _value: string): string;
|
|
4
|
+
export declare function CheckSchemaBoolean(_stack: Stack.XStack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
|
|
5
|
+
export declare function ErrorSchemaBoolean(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
|
|
@@ -16,10 +16,6 @@ export function CheckSchemaBoolean(_stack, _context, schema, _value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckSchemaBoolean(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: {}
|
|
24
|
-
});
|
|
19
|
+
return CheckSchemaBoolean(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('boolean', schemaPath, instancePath, {});
|
|
25
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildConst(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XConst, value: string): string;
|
|
5
|
+
export declare function CheckConst(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorConst(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
|
|
@@ -21,10 +21,6 @@ export function CheckConst(_stack, _context, schema, value) {
|
|
|
21
21
|
// Check
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
23
|
export function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
|
|
24
|
-
return CheckConst(stack, context, schema, value) ||
|
|
25
|
-
|
|
26
|
-
schemaPath,
|
|
27
|
-
instancePath,
|
|
28
|
-
params: { allowedValue: schema.const },
|
|
29
|
-
});
|
|
24
|
+
return CheckConst(stack, context, schema, value) ||
|
|
25
|
+
context.AddError('const', schemaPath, instancePath, { allowedValue: schema.const });
|
|
30
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildContains(stack: Stack.XStack, context: BuildContext, schema: Schema.XContains, value: string): string;
|
|
5
|
+
export declare function CheckContains(stack: Stack.XStack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorContains(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
|
|
@@ -45,10 +45,6 @@ export function CheckContains(stack, context, schema, value) {
|
|
|
45
45
|
// Error
|
|
46
46
|
// ------------------------------------------------------------------
|
|
47
47
|
export function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
|
|
48
|
-
return CheckContains(stack, context, schema, value) ||
|
|
49
|
-
|
|
50
|
-
schemaPath,
|
|
51
|
-
instancePath,
|
|
52
|
-
params: { minContains: 1 },
|
|
53
|
-
});
|
|
48
|
+
return CheckContains(stack, context, schema, value) ||
|
|
49
|
+
context.AddError('contains', schemaPath, instancePath, { minContains: 1 });
|
|
54
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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
|
+
export declare function BuildDependencies(stack: Stack.XStack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
|
|
5
|
+
export declare function CheckDependencies(stack: Stack.XStack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependencies(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -34,12 +34,9 @@ export function ErrorDependencies(stack, context, schemaPath, instancePath, sche
|
|
|
34
34
|
const isEvery = G.EveryAll(G.Entries(schema.dependencies), 0, ([key, schema]) => {
|
|
35
35
|
const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
|
|
36
36
|
return !G.HasPropertyKey(value, key) || (G.IsArray(schema)
|
|
37
|
-
? schema.every((dependency) => G.HasPropertyKey(value, dependency) ||
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
instancePath,
|
|
41
|
-
params: { property: key, dependencies: schema },
|
|
42
|
-
})) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
|
|
37
|
+
? schema.every((dependency) => G.HasPropertyKey(value, dependency) ||
|
|
38
|
+
context.AddError('dependencies', schemaPath, instancePath, { property: key, dependencies: schema }))
|
|
39
|
+
: ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
|
|
43
40
|
});
|
|
44
41
|
return isLength || isEvery;
|
|
45
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildDependentRequired(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XDependentRequired, value: string): string;
|
|
5
|
+
export declare function CheckDependentRequired(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependentRequired(_stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -29,12 +29,8 @@ export function CheckDependentRequired(_stack, _context, schema, value) {
|
|
|
29
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
|
-
return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) ||
|
|
33
|
-
|
|
34
|
-
schemaPath,
|
|
35
|
-
instancePath,
|
|
36
|
-
params: { property: key, dependencies: keys },
|
|
37
|
-
}));
|
|
32
|
+
return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) ||
|
|
33
|
+
context.AddError('dependentRequired', schemaPath, instancePath, { property: key, dependencies: keys }));
|
|
38
34
|
});
|
|
39
35
|
return isLength || isEveryEntry;
|
|
40
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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
|
+
export declare function BuildDependentSchemas(stack: Stack.XStack, context: BuildContext, schema: Schema.XDependentSchemas, value: string): string;
|
|
5
|
+
export declare function CheckDependentSchemas(stack: Stack.XStack, context: CheckContext, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependentSchemas(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildDynamicRef(stack: Stack, context: BuildContext, schema: Schema.XDynamicRef, value: string): string;
|
|
5
|
-
export declare function CheckDynamicRef(stack: Stack, context: CheckContext, schema: Schema.XDynamicRef, value: unknown): boolean;
|
|
6
|
-
export declare function ErrorDynamicRef(stack: Stack, context: ErrorContext, _schemaPath: string, instancePath: string, schema: Schema.XDynamicRef, value: unknown): boolean;
|
|
4
|
+
export declare function BuildDynamicRef(stack: Stack.XStack, context: BuildContext, schema: Schema.XDynamicRef, value: string): string;
|
|
5
|
+
export declare function CheckDynamicRef(stack: Stack.XStack, context: CheckContext, schema: Schema.XDynamicRef, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorDynamicRef(stack: Stack.XStack, context: ErrorContext, _schemaPath: string, instancePath: string, schema: Schema.XDynamicRef, value: unknown): boolean;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Functions from './_functions.mjs';
|
|
3
2
|
import * as Schema from '../types/index.mjs';
|
|
3
|
+
import * as Functions from './_functions.mjs';
|
|
4
|
+
import { Resolve } from '../resolve/index.mjs';
|
|
4
5
|
import { CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
6
|
// ------------------------------------------------------------------
|
|
6
7
|
// Build
|
|
7
8
|
// ------------------------------------------------------------------
|
|
8
9
|
export function BuildDynamicRef(stack, context, schema, value) {
|
|
9
|
-
const target =
|
|
10
|
-
|
|
10
|
+
const target = Resolve.DynamicRef(stack, schema) ?? false;
|
|
11
|
+
const nextStack = target ? { ...stack, pendingResource: true } : stack;
|
|
12
|
+
return Functions.CreateFunction(nextStack, context, target, value);
|
|
11
13
|
}
|
|
12
14
|
// ------------------------------------------------------------------
|
|
13
15
|
// Check
|
|
14
16
|
// ------------------------------------------------------------------
|
|
15
17
|
export function CheckDynamicRef(stack, context, schema, value) {
|
|
16
|
-
const target =
|
|
17
|
-
|
|
18
|
+
const target = Resolve.DynamicRef(stack, schema) ?? false;
|
|
19
|
+
const nextStack = target ? { ...stack, pendingResource: true } : stack;
|
|
20
|
+
return (Schema.IsSchema(target) && CheckSchema(nextStack, context, target, value));
|
|
18
21
|
}
|
|
19
22
|
// ------------------------------------------------------------------
|
|
20
23
|
// Error
|
|
21
24
|
// ------------------------------------------------------------------
|
|
22
25
|
export function ErrorDynamicRef(stack, context, _schemaPath, instancePath, schema, value) {
|
|
23
|
-
const target =
|
|
24
|
-
|
|
26
|
+
const target = Resolve.DynamicRef(stack, schema) ?? false;
|
|
27
|
+
const nextStack = target ? { ...stack, pendingResource: true } : stack;
|
|
28
|
+
return (Schema.IsSchema(target) && ErrorSchema(nextStack, context, '#', instancePath, target, value));
|
|
25
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildEnum(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XEnum, value: string): string;
|
|
5
|
+
export declare function CheckEnum(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XEnum, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorEnum(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XEnum, value: unknown): boolean;
|
|
@@ -24,10 +24,6 @@ export function CheckEnum(_stack, _context, schema, value) {
|
|
|
24
24
|
// Error
|
|
25
25
|
// ------------------------------------------------------------------
|
|
26
26
|
export function ErrorEnum(stack, context, schemaPath, instancePath, schema, value) {
|
|
27
|
-
return CheckEnum(stack, context, schema, value) ||
|
|
28
|
-
|
|
29
|
-
schemaPath,
|
|
30
|
-
instancePath,
|
|
31
|
-
params: { allowedValues: schema.enum }
|
|
32
|
-
});
|
|
27
|
+
return CheckEnum(stack, context, schema, value) ||
|
|
28
|
+
context.AddError('enum', schemaPath, instancePath, { allowedValues: schema.enum });
|
|
33
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildExclusiveMaximum(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XExclusiveMaximum, value: string): string;
|
|
5
|
+
export declare function CheckExclusiveMaximum(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorExclusiveMaximum(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
@@ -16,10 +16,6 @@ export function CheckExclusiveMaximum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckExclusiveMaximum(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: { comparison: '<', limit: schema.exclusiveMaximum }
|
|
24
|
-
});
|
|
19
|
+
return CheckExclusiveMaximum(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('exclusiveMaximum', schemaPath, instancePath, { comparison: '<', limit: schema.exclusiveMaximum });
|
|
25
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
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;
|
|
4
|
+
export declare function BuildExclusiveMinimum(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XExclusiveMinimum, value: string): string;
|
|
5
|
+
export declare function CheckExclusiveMinimum(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorExclusiveMinimum(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|
|
@@ -16,10 +16,6 @@ export function CheckExclusiveMinimum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckExclusiveMinimum(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: { comparison: '>', limit: schema.exclusiveMinimum }
|
|
24
|
-
});
|
|
19
|
+
return CheckExclusiveMinimum(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('exclusiveMinimum', schemaPath, instancePath, { comparison: '>', limit: schema.exclusiveMinimum });
|
|
25
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildFormat(_stack: Stack, _context: BuildContext, schema: Schema.XFormat, value: string): string;
|
|
5
|
-
export declare function CheckFormat(_stack: Stack, _context: CheckContext, schema: Schema.XFormat, value: string): boolean;
|
|
6
|
-
export declare function ErrorFormat(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XFormat, value: string): boolean;
|
|
4
|
+
export declare function BuildFormat(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XFormat, value: string): string;
|
|
5
|
+
export declare function CheckFormat(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XFormat, value: string): boolean;
|
|
6
|
+
export declare function ErrorFormat(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XFormat, value: string): boolean;
|
|
@@ -17,10 +17,6 @@ export function CheckFormat(_stack, _context, schema, value) {
|
|
|
17
17
|
// Error
|
|
18
18
|
// ------------------------------------------------------------------
|
|
19
19
|
export function ErrorFormat(stack, context, schemaPath, instancePath, schema, value) {
|
|
20
|
-
return CheckFormat(stack, context, schema, value) ||
|
|
21
|
-
|
|
22
|
-
schemaPath,
|
|
23
|
-
instancePath,
|
|
24
|
-
params: { format: schema.format },
|
|
25
|
-
});
|
|
20
|
+
return CheckFormat(stack, context, schema, value) ||
|
|
21
|
+
context.AddError('format', schemaPath, instancePath, { format: schema.format });
|
|
26
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildIf(stack: Stack, context: BuildContext, schema: Schema.XIf, value: string): string;
|
|
5
|
-
export declare function CheckIf(stack: Stack, context: CheckContext, schema: Schema.XIf, value: unknown): boolean;
|
|
6
|
-
export declare function ErrorIf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XIf, value: unknown): boolean;
|
|
4
|
+
export declare function BuildIf(stack: Stack.XStack, context: BuildContext, schema: Schema.XIf, value: string): string;
|
|
5
|
+
export declare function CheckIf(stack: Stack.XStack, context: CheckContext, schema: Schema.XIf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorIf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XIf, value: unknown): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
3
|
import { ErrorContext } from './_context.mjs';
|
|
4
|
-
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
5
4
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
|
+
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
@@ -29,18 +29,10 @@ export function ErrorIf(stack, context, schemaPath, instancePath, schema, value)
|
|
|
29
29
|
const elseSchema = Schema.IsElse(schema) ? schema.else : true;
|
|
30
30
|
const trueContext = new ErrorContext();
|
|
31
31
|
const isIf = ErrorSchema(stack, trueContext, `${schemaPath}/if`, instancePath, schema.if, value)
|
|
32
|
-
? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) ||
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
instancePath,
|
|
36
|
-
params: { failingKeyword: 'then' },
|
|
37
|
-
})
|
|
38
|
-
: ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) || context.AddError({
|
|
39
|
-
keyword: 'if',
|
|
40
|
-
schemaPath,
|
|
41
|
-
instancePath,
|
|
42
|
-
params: { failingKeyword: 'else' },
|
|
43
|
-
});
|
|
32
|
+
? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) ||
|
|
33
|
+
context.AddError('if', schemaPath, instancePath, { failingKeyword: 'then' })
|
|
34
|
+
: ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) ||
|
|
35
|
+
context.AddError('if', schemaPath, instancePath, { failingKeyword: 'else' });
|
|
44
36
|
if (isIf)
|
|
45
37
|
context.Merge([trueContext]);
|
|
46
38
|
return isIf;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildItems(stack: Stack, context: BuildContext, schema: Schema.XItems, value: string): string;
|
|
5
|
-
export declare function CheckItems(stack: Stack, context: CheckContext, schema: Schema.XItems, value: unknown[]): boolean;
|
|
6
|
-
export declare function ErrorItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XItems, value: unknown[]): boolean;
|
|
4
|
+
export declare function BuildItems(stack: Stack.XStack, context: BuildContext, schema: Schema.XItems, value: string): string;
|
|
5
|
+
export declare function CheckItems(stack: Stack.XStack, context: CheckContext, schema: Schema.XItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorItems(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XItems, value: unknown[]): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
|
-
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
3
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
4
|
+
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
// ItemsSized
|
|
7
7
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxContains(stack: Stack, context: BuildContext, schema: Schema.XMaxContains, value: string): string;
|
|
5
|
-
export declare function CheckMaxContains(stack: Stack, context: CheckContext, schema: Schema.XMaxContains, value: unknown[]): boolean;
|
|
6
|
-
export declare function ErrorMaxContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxContains, value: unknown[]): boolean;
|
|
4
|
+
export declare function BuildMaxContains(stack: Stack.XStack, context: BuildContext, schema: Schema.XMaxContains, value: string): string;
|
|
5
|
+
export declare function CheckMaxContains(stack: Stack.XStack, context: CheckContext, schema: Schema.XMaxContains, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorMaxContains(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxContains, value: unknown[]): boolean;
|
|
@@ -33,10 +33,6 @@ export function CheckMaxContains(stack, context, schema, value) {
|
|
|
33
33
|
// ------------------------------------------------------------------
|
|
34
34
|
export function ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value) {
|
|
35
35
|
const minContains = Schema.IsMinContains(schema) ? schema.minContains : 1;
|
|
36
|
-
return CheckMaxContains(stack, context, schema, value) ||
|
|
37
|
-
|
|
38
|
-
schemaPath,
|
|
39
|
-
instancePath,
|
|
40
|
-
params: { minContains, maxContains: schema.maxContains },
|
|
41
|
-
});
|
|
36
|
+
return CheckMaxContains(stack, context, schema, value) ||
|
|
37
|
+
context.AddError('contains', schemaPath, instancePath, { minContains, maxContains: schema.maxContains });
|
|
42
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxItems(_stack: Stack, _context: BuildContext, schema: Schema.XMaxItems, value: string): string;
|
|
5
|
-
export declare function CheckMaxItems(_stack: Stack, _context: CheckContext, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
6
|
-
export declare function ErrorMaxItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
4
|
+
export declare function BuildMaxItems(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XMaxItems, value: string): string;
|
|
5
|
+
export declare function CheckMaxItems(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorMaxItems(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
@@ -16,10 +16,6 @@ export function CheckMaxItems(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaxItems(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: { limit: schema.maxItems }
|
|
24
|
-
});
|
|
19
|
+
return CheckMaxItems(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('maxItems', schemaPath, instancePath, { limit: schema.maxItems });
|
|
25
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxLength(_stack: Stack, _context: BuildContext, schema: Schema.XMaxLength, value: string): string;
|
|
5
|
-
export declare function CheckMaxLength(_stack: Stack, _context: CheckContext, schema: Schema.XMaxLength, value: string): boolean;
|
|
6
|
-
export declare function ErrorMaxLength(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxLength, value: string): boolean;
|
|
4
|
+
export declare function BuildMaxLength(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XMaxLength, value: string): string;
|
|
5
|
+
export declare function CheckMaxLength(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XMaxLength, value: string): boolean;
|
|
6
|
+
export declare function ErrorMaxLength(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxLength, value: string): boolean;
|
|
@@ -16,10 +16,6 @@ export function CheckMaxLength(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaxLength(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: { limit: schema.maxLength }
|
|
24
|
-
});
|
|
19
|
+
return CheckMaxLength(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('maxLength', schemaPath, instancePath, { limit: schema.maxLength });
|
|
25
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxProperties(_stack: Stack, _context: BuildContext, schema: Schema.XMaxProperties, value: string): string;
|
|
5
|
-
export declare function CheckMaxProperties(_stack: Stack, _context: CheckContext, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
-
export declare function ErrorMaxProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
4
|
+
export declare function BuildMaxProperties(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XMaxProperties, value: string): string;
|
|
5
|
+
export declare function CheckMaxProperties(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorMaxProperties(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -16,10 +16,6 @@ export function CheckMaxProperties(_stack, _context, schema, value) {
|
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaxProperties(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: { limit: schema.maxProperties },
|
|
24
|
-
});
|
|
19
|
+
return CheckMaxProperties(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('maxProperties', schemaPath, instancePath, { limit: schema.maxProperties });
|
|
25
21
|
}
|