@hpcc-js/ddl-shim 3.3.1 → 3.3.4

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/src/validate.ts CHANGED
@@ -1,38 +1,38 @@
1
- import * as _Ajv from "ajv";
2
- import * as DDL from "./ddl/v1.ts";
3
- import * as DDL2 from "./ddl/v2.ts";
4
-
5
- const Ajv = (_Ajv as any).default || _Ajv;
6
-
7
- export const ddl2Schema: object = _ddl2Schema;
8
-
9
- const options: _Ajv.Options = {
10
- allErrors: false,
11
- verbose: true,
12
- jsonPointers: false
13
- };
14
-
15
- function doValidate(ddl: DDL.DDLSchema | DDL2.Schema, schema: DDL.DDLSchema | DDL2.Schema) {
16
- const ajv: _Ajv.Ajv = new Ajv(options);
17
- const validate = ajv.compile(schema);
18
- const success = validate(ddl);
19
- return {
20
- success,
21
- errors: validate.errors
22
- };
23
- }
24
-
25
- /* Not needed ---
26
- // @ts-ignore
27
- import * as ddlSchema from "../schema/v1.json";
28
-
29
- export function validate(ddl: DDL.DDLSchema) {
30
- return doValidate(ddl, ddlSchema);
31
- }
32
- */
33
-
34
- import _ddl2Schema from "../schema/v2.json" with { type: "json" };
35
-
36
- export function validate2(ddl: DDL2.Schema) {
37
- return doValidate(ddl, _ddl2Schema as any);
38
- }
1
+ import * as _Ajv from "ajv";
2
+ import * as DDL from "./ddl/v1.ts";
3
+ import * as DDL2 from "./ddl/v2.ts";
4
+
5
+ const Ajv = (_Ajv as any).default || _Ajv;
6
+
7
+ export const ddl2Schema: object = _ddl2Schema;
8
+
9
+ const options: _Ajv.Options = {
10
+ allErrors: false,
11
+ verbose: true,
12
+ jsonPointers: false
13
+ };
14
+
15
+ function doValidate(ddl: DDL.DDLSchema | DDL2.Schema, schema: DDL.DDLSchema | DDL2.Schema) {
16
+ const ajv: _Ajv.Ajv = new Ajv(options);
17
+ const validate = ajv.compile(schema);
18
+ const success = validate(ddl);
19
+ return {
20
+ success,
21
+ errors: validate.errors
22
+ };
23
+ }
24
+
25
+ /* Not needed ---
26
+ // @ts-ignore
27
+ import * as ddlSchema from "../schema/v1.json";
28
+
29
+ export function validate(ddl: DDL.DDLSchema) {
30
+ return doValidate(ddl, ddlSchema);
31
+ }
32
+ */
33
+
34
+ import _ddl2Schema from "../schema/v2.json" with { type: "json" };
35
+
36
+ export function validate2(ddl: DDL2.Schema) {
37
+ return doValidate(ddl, _ddl2Schema as any);
38
+ }