@fincity/kirun-js 2.14.0 → 2.15.1
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/__tests__/engine/function/system/array/ConcatenateTest.ts +1 -3
- package/__tests__/engine/function/system/date/FromNowTest.ts +2 -3
- package/__tests__/engine/function/system/date/ToDateStringTest.ts +1 -1
- package/__tests__/engine/json/schema/validator/NumberValidatorTest.ts +16 -0
- package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +1 -1
- package/__tests__/engine/json/schema/validator/StringFormatSchemaValidatorTest.ts +6 -11
- package/__tests__/engine/json/schema/validator/StringValidatorTest.ts +17 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +34 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/engine/json/schema/Schema.ts +121 -7
- package/src/engine/json/schema/validator/NumberValidator.ts +5 -0
- package/src/engine/json/schema/validator/ObjectValidator.ts +1 -2
- package/src/engine/json/schema/validator/SchemaValidator.ts +6 -2
- package/src/engine/json/schema/validator/StringValidator.ts +3 -0
- package/src/engine/runtime/KIRuntime.ts +1 -1
|
@@ -198,12 +198,16 @@ export class SchemaValidator {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
if (errors.length == 1) {
|
|
202
|
+
throw new SchemaValidationException(
|
|
203
|
+
SchemaValidator.path(parents),
|
|
204
|
+
errors[0].message);
|
|
205
|
+
}
|
|
206
|
+
|
|
201
207
|
throw new SchemaValidationException(
|
|
202
208
|
SchemaValidator.path(parents),
|
|
203
209
|
'Value ' + JSON.stringify(element) + ' is not of valid type(s)',
|
|
204
210
|
errors,
|
|
205
211
|
);
|
|
206
212
|
}
|
|
207
|
-
|
|
208
|
-
private constructor() {}
|
|
209
213
|
}
|
|
@@ -76,11 +76,13 @@ export class StringValidator {
|
|
|
76
76
|
if (schema.getMinLength() && length < schema.getMinLength()!) {
|
|
77
77
|
throw new SchemaValidationException(
|
|
78
78
|
SchemaValidator.path(parents),
|
|
79
|
+
schema.getDetails()?.getValidationMessage('minLength') ??
|
|
79
80
|
'Expected a minimum of ' + schema.getMinLength() + ' characters',
|
|
80
81
|
);
|
|
81
82
|
} else if (schema.getMaxLength() && length > schema.getMaxLength()!) {
|
|
82
83
|
throw new SchemaValidationException(
|
|
83
84
|
SchemaValidator.path(parents),
|
|
85
|
+
schema.getDetails()?.getValidationMessage('maxLength') ??
|
|
84
86
|
'Expected a maximum of ' + schema.getMaxLength() + ' characters',
|
|
85
87
|
);
|
|
86
88
|
}
|
|
@@ -99,6 +101,7 @@ export class StringValidator {
|
|
|
99
101
|
if (!matched) {
|
|
100
102
|
throw new SchemaValidationException(
|
|
101
103
|
SchemaValidator.path(parents),
|
|
104
|
+
schema.getDetails()?.getValidationMessage('pattern') ??
|
|
102
105
|
element.toString() + ' is not matched with the ' + message,
|
|
103
106
|
);
|
|
104
107
|
}
|