@depup/typebox 1.3.22-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/compile/validator.d.mts +1 -1
- package/build/compile/validator.mjs +1 -1
- package/build/format/iri.mjs +5 -1
- package/build/schema/build.mjs +2 -2
- package/build/schema/check.mjs +1 -1
- package/build/schema/compile.d.mts +3 -2
- package/build/schema/compile.mjs +8 -8
- package/build/schema/engine/_context.d.mts +6 -7
- package/build/schema/engine/_context.mjs +23 -15
- 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 -16
- package/build/schema/engine/_stack.mjs +148 -104
- package/build/schema/engine/additionalItems.d.mts +4 -4
- package/build/schema/engine/additionalProperties.d.mts +8 -8
- package/build/schema/engine/additionalProperties.mjs +11 -17
- package/build/schema/engine/allOf.d.mts +4 -4
- package/build/schema/engine/allOf.mjs +3 -3
- package/build/schema/engine/anyOf.d.mts +4 -4
- package/build/schema/engine/anyOf.mjs +5 -10
- 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 +7 -15
- 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 +6 -11
- 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 +4 -10
- 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 +19 -15
- 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 +137 -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 +5 -9
- package/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/build/schema/engine/uniqueItems.d.mts +4 -4
- package/build/schema/engine/uniqueItems.mjs +2 -6
- package/build/schema/errors.d.mts +2 -2
- package/build/schema/errors.mjs +8 -14
- package/build/schema/intern/index.d.mts +1 -0
- package/build/schema/intern/index.mjs +1 -0
- package/build/schema/intern/intern.d.mts +11 -0
- package/build/schema/intern/intern.mjs +293 -0
- 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/parse.d.mts +1 -0
- package/build/schema/parse.mjs +10 -5
- package/build/schema/resolve/resolve.d.mts +8 -3
- package/build/schema/resolve/resolve.mjs +268 -139
- package/build/schema/schema.d.mts +2 -0
- package/build/schema/schema.mjs +2 -0
- package/build/value/errors/errors.d.mts +2 -12
- package/build/value/errors/errors.mjs +2 -7
- package/changes.json +1 -1
- package/package.json +3 -3
- package/readme.md +59 -89
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function CanAdditionalPropertiesFast(_context: BuildContext, schema:
|
|
5
|
-
export declare function BuildAdditionalPropertiesFast(_context: BuildContext, schema:
|
|
6
|
-
export declare function BuildAdditionalPropertiesStandard(stack: Stack, context: BuildContext, schema:
|
|
7
|
-
export declare function BuildAdditionalProperties(stack: Stack, context: BuildContext, schema:
|
|
8
|
-
export declare function CheckAdditionalProperties(stack: Stack, context: CheckContext, schema:
|
|
9
|
-
export declare function ErrorAdditionalProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema:
|
|
4
|
+
export declare function CanAdditionalPropertiesFast(_context: BuildContext, schema: Schema.XAdditionalProperties, _value: string): schema is Schema.XAdditionalProperties & Schema.XRequired;
|
|
5
|
+
export declare function BuildAdditionalPropertiesFast(_context: BuildContext, schema: Schema.XAdditionalProperties & Schema.XRequired, value: string): string;
|
|
6
|
+
export declare function BuildAdditionalPropertiesStandard(stack: Stack.XStack, context: BuildContext, schema: Schema.XAdditionalProperties, value: string): string;
|
|
7
|
+
export declare function BuildAdditionalProperties(stack: Stack.XStack, context: BuildContext, schema: Schema.XAdditionalProperties, value: string): string;
|
|
8
|
+
export declare function CheckAdditionalProperties(stack: Stack.XStack, context: CheckContext, schema: Schema.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
9
|
+
export declare function ErrorAdditionalProperties(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
-
import { AccumulatedErrorContext } from './_context.mjs';
|
|
6
5
|
import { UnicodeRegExp } from './_regexp.mjs';
|
|
7
6
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
8
7
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
@@ -35,9 +34,9 @@ function GetPropertyKeyAsPattern(key) {
|
|
|
35
34
|
}
|
|
36
35
|
function GetPropertiesPattern(schema) {
|
|
37
36
|
const patterns = [];
|
|
38
|
-
if (
|
|
37
|
+
if (Schema.IsPatternProperties(schema))
|
|
39
38
|
patterns.push(...G.Keys(schema.patternProperties));
|
|
40
|
-
if (
|
|
39
|
+
if (Schema.IsProperties(schema))
|
|
41
40
|
patterns.push(...G.Keys(schema.properties).map(GetPropertyKeyAsPattern));
|
|
42
41
|
return G.IsEqual(patterns.length, 0) ? '(?!)' : `(${patterns.join('|')})`;
|
|
43
42
|
}
|
|
@@ -57,9 +56,9 @@ function GetPropertiesPattern(schema) {
|
|
|
57
56
|
//
|
|
58
57
|
// ------------------------------------------------------------------
|
|
59
58
|
export function CanAdditionalPropertiesFast(_context, schema, _value) {
|
|
60
|
-
return
|
|
61
|
-
&&
|
|
62
|
-
&& !
|
|
59
|
+
return Schema.IsRequired(schema)
|
|
60
|
+
&& Schema.IsProperties(schema)
|
|
61
|
+
&& !Schema.IsPatternProperties(schema)
|
|
63
62
|
&& G.IsEqual(schema.additionalProperties, false)
|
|
64
63
|
&& G.IsEqual(G.Keys(schema.properties).length, schema.required.length);
|
|
65
64
|
}
|
|
@@ -71,7 +70,7 @@ export function BuildAdditionalPropertiesFast(_context, schema, value) {
|
|
|
71
70
|
// ------------------------------------------------------------------
|
|
72
71
|
export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
|
|
73
72
|
const [key, _index] = [Unique(), Unique()];
|
|
74
|
-
const regexp =
|
|
73
|
+
const regexp = Externals.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
|
|
75
74
|
const isSchema = BuildSchemaPushStack(stack, context, schema.additionalProperties, `${value}[${key}]`);
|
|
76
75
|
const isKey = E.Call(E.Member(regexp, 'test'), [key]);
|
|
77
76
|
const addKey = context.AddKey(key);
|
|
@@ -109,17 +108,12 @@ export function ErrorAdditionalProperties(stack, context, schemaPath, instancePa
|
|
|
109
108
|
const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key, _index) => {
|
|
110
109
|
const nextSchemaPath = `${schemaPath}/additionalProperties`;
|
|
111
110
|
const nextInstancePath = `${instancePath}/${key}`;
|
|
112
|
-
const nextContext = new AccumulatedErrorContext();
|
|
113
111
|
const isAdditionalProperty = regexp.test(key) ||
|
|
114
|
-
(ErrorSchemaPushStack(stack,
|
|
112
|
+
(ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key));
|
|
115
113
|
if (!isAdditionalProperty)
|
|
116
114
|
additionalProperties.push(key);
|
|
117
115
|
return isAdditionalProperty;
|
|
118
116
|
});
|
|
119
|
-
return isAdditionalProperties ||
|
|
120
|
-
|
|
121
|
-
schemaPath,
|
|
122
|
-
instancePath,
|
|
123
|
-
params: { additionalProperties },
|
|
124
|
-
});
|
|
117
|
+
return isAdditionalProperties ||
|
|
118
|
+
context.AddError('additionalProperties', schemaPath, instancePath, { additionalProperties });
|
|
125
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { CheckContext,
|
|
2
|
+
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
3
3
|
import { Reducer } from './_reducer.mjs';
|
|
4
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
5
5
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
@@ -34,7 +34,7 @@ export function ErrorAllOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
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
|
|
37
|
+
const nextContext = new ErrorContext();
|
|
38
38
|
const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema, value);
|
|
39
39
|
if (!isSchema)
|
|
40
40
|
failedContexts.push(nextContext);
|
|
@@ -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, AccumulatedErrorContext } 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
|
// ------------------------------------------------------------------
|
|
@@ -33,7 +33,7 @@ export function CheckAnyOf(stack, context, schema, value) {
|
|
|
33
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
|
|
36
|
+
const nextContext = new ErrorContext();
|
|
37
37
|
const nextSchemaPath = `${schemaPath}/anyOf/${index}`;
|
|
38
38
|
const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema, value);
|
|
39
39
|
if (!isSchema)
|
|
@@ -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
|
-
import {
|
|
4
|
-
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
3
|
+
import { ErrorContext } from './_context.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
|
// ------------------------------------------------------------------
|
|
@@ -27,20 +27,12 @@ export function CheckIf(stack, context, schema, value) {
|
|
|
27
27
|
export function ErrorIf(stack, context, schemaPath, instancePath, schema, value) {
|
|
28
28
|
const thenSchema = Schema.IsThen(schema) ? schema.then : true;
|
|
29
29
|
const elseSchema = Schema.IsElse(schema) ? schema.else : true;
|
|
30
|
-
const trueContext = new
|
|
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;
|