@takeshape/json-schema 9.12.0 → 9.14.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ErrorObject, Options, SchemaObject } from 'ajv';
|
|
2
2
|
import Ajv from 'ajv';
|
|
3
|
-
export
|
|
3
|
+
export type Data = any;
|
|
4
4
|
export interface ValidateParams {
|
|
5
5
|
ignoreMissing: boolean;
|
|
6
6
|
ignoreNulls: boolean;
|
|
@@ -11,7 +11,7 @@ export interface ValidateResult {
|
|
|
11
11
|
errorsText: string;
|
|
12
12
|
errors: ErrorObject[];
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type Validator = (data: Data, options?: Partial<ValidateParams>) => ValidateResult;
|
|
15
15
|
export declare function parseDataPath(instancePath: string): string[];
|
|
16
16
|
export declare function isInvalidPropertyRequired(topLevelSchema: SchemaObject, error: ErrorObject): boolean;
|
|
17
17
|
export declare function refToPath(ref: string): string[];
|
|
@@ -19,7 +19,7 @@ export declare function refToPath(ref: string): string[];
|
|
|
19
19
|
* Given a schema object traverse it using a "instancePath" and return the schema at that path
|
|
20
20
|
*/
|
|
21
21
|
export declare function followSchemaPath(topLevelSchema: SchemaObject, instancePath: string[]): SchemaObject | undefined;
|
|
22
|
-
export
|
|
22
|
+
export type MinimalAjv = Pick<Ajv, 'validate' | 'errors' | 'getSchema' | 'errorsText'>;
|
|
23
23
|
export declare function validate(ajv: MinimalAjv, id: string, data: Data, options?: Partial<ValidateParams>): ValidateResult;
|
|
24
24
|
export { Ajv, ErrorObject };
|
|
25
25
|
export declare function createAjv(options?: Options): Ajv;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/schema-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,KAAK,CAAC;AAC5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OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CA2BnH;AAED,OAAO,EAAC,GAAG,EAAE,WAAW,EAAC,CAAC;AAC1B,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,GAAG,CAmBhD;AAeD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAmB5D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,GAAG,YAAY,EAAE,EACrC,WAAW,GAAE,YAAY,EAAO,EAChC,OAAO,GAAE,OAAY,GACpB,SAAS,CAqBX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/json-schema",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.14.0",
|
|
4
4
|
"description": "JSON Schema validator",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,26 +20,29 @@
|
|
|
20
20
|
"ajv": "^8.11.0",
|
|
21
21
|
"ajv-formats": "^2.1.1",
|
|
22
22
|
"lodash": "^4.17.21",
|
|
23
|
-
"@takeshape/util": "9.
|
|
23
|
+
"@takeshape/util": "9.14.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/lodash": "^4.14.165"
|
|
26
|
+
"@types/lodash": "^4.14.165",
|
|
27
|
+
"@takeshape/typescript-jest-junit-reporter": "9.14.0"
|
|
27
28
|
},
|
|
28
29
|
"engines": {
|
|
29
30
|
"node": ">=16"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
|
-
"build": "pnpm build:
|
|
33
|
+
"build": "pnpm build:js && pnpm build:es && pnpm build:types && pnpm build:copy",
|
|
34
|
+
"build:ci": "pnpm build:js && pnpm build:es && pnpm build:types:ci && pnpm build:copy",
|
|
33
35
|
"build:copy": "cp -rf build/src/* dist/",
|
|
34
36
|
"build:es": "cross-env BABEL_MODULES=es babel src --out-dir es --extensions \".js,.ts\" --ignore '**/__tests__'",
|
|
35
37
|
"build:js": "cross-env BABEL_MODULES=commonjs babel src --out-dir dist --extensions \".js,.ts\" --ignore '**/__tests__'",
|
|
36
38
|
"build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json",
|
|
39
|
+
"build:types:ci": "mkdir -p \"${GITHUB_WORKSPACE}/typecheck-results/${npm_package_name#*\\/}\" && tsc --emitDeclarationOnly --project tsconfig.build.json --pretty false | typescript-jest-junit-reporter | tee \"${GITHUB_WORKSPACE}/typecheck-results/${npm_package_name#*\\/}/typescript-results.xml\"",
|
|
37
40
|
"clean": "rimraf dist es build *.tsbuildinfo",
|
|
38
41
|
"lint": "eslint . --ext .js,.ts,.json",
|
|
39
|
-
"lint:
|
|
42
|
+
"lint:ci": "pnpm lint --quiet --format json -o \"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}/eslint-results.json\"",
|
|
40
43
|
"test": "jest",
|
|
41
44
|
"test-changed": "pnpm run test --changedSince=master",
|
|
42
|
-
"test:ci": "JEST_JUNIT_OUTPUT_DIR=\"${
|
|
45
|
+
"test:ci": "JEST_JUNIT_OUTPUT_DIR=\"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}\" JEST_JUNIT_OUTPUT_NAME=\"jest-results.xml\" jest --silent --ci --coverageDirectory=\"${GITHUB_WORKSPACE}/coverage/${npm_package_name#*\\/}\" --reporters=default --reporters=jest-junit --maxWorkers=4",
|
|
43
46
|
"todo": "leasot 'src/**/*.{js,jsx,ts,tsx}'",
|
|
44
47
|
"typecheck": "tsc --noEmit"
|
|
45
48
|
}
|