z-schema 8.2.0 → 8.3.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/cjs/index.d.ts +7 -2
- package/cjs/index.js +106 -105
- package/dist/json-validation.js +28 -28
- package/dist/report.js +4 -3
- package/dist/schema-validator.js +74 -74
- package/dist/types/report.d.ts +7 -2
- package/package.json +1 -1
- package/src/json-validation.ts +46 -28
- package/src/report.ts +17 -3
- package/src/schema-validator.ts +122 -74
- package/umd/ZSchema.js +106 -105
- package/umd/ZSchema.min.js +1 -1
package/cjs/index.d.ts
CHANGED
|
@@ -160,6 +160,11 @@ interface SchemaErrorDetail {
|
|
|
160
160
|
*/
|
|
161
161
|
inner?: SchemaErrorDetail[];
|
|
162
162
|
schemaId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* The schema keyword that caused this validation error.
|
|
165
|
+
* Example: "required", "type", "minLength"
|
|
166
|
+
*/
|
|
167
|
+
keyword?: keyof JsonSchema;
|
|
163
168
|
}
|
|
164
169
|
interface ReportOptions {
|
|
165
170
|
maxErrors?: number;
|
|
@@ -190,9 +195,9 @@ declare class Report {
|
|
|
190
195
|
getPath(returnPathAsString?: boolean): string | (string | number)[];
|
|
191
196
|
getSchemaId(): string | undefined;
|
|
192
197
|
hasError(errCode: string, errParams: Array<any>): boolean;
|
|
193
|
-
addError(errCode: ErrorCode, errParams?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema): void;
|
|
198
|
+
addError(errCode: ErrorCode, errParams?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema, keyword?: keyof JsonSchema): void;
|
|
194
199
|
getJson(): unknown;
|
|
195
|
-
addCustomError(errorCode: ErrorCode, errorMessage: string, params?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema): void;
|
|
200
|
+
addCustomError(errorCode: ErrorCode, errorMessage: string, params?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema, keyword?: keyof JsonSchema): void;
|
|
196
201
|
}
|
|
197
202
|
|
|
198
203
|
type FormatValidatorFn = (input: unknown) => boolean;
|