mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 01:22:54 +00:00
refactor: update all
This commit is contained in:
committed by
Rainer Killinger
parent
8cf40900bb
commit
0ca252b221
1738
package-lock.json
generated
1738
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
53
package.json
53
package.json
@@ -45,53 +45,54 @@
|
|||||||
"lint": "eslint -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/"
|
"lint": "eslint -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openstapps/logger": "0.7.0",
|
"@openstapps/logger": "0.8.0",
|
||||||
"ajv": "8.6.3",
|
"ajv": "8.8.2",
|
||||||
"better-ajv-errors": "0.7.0",
|
"better-ajv-errors": "1.1.2",
|
||||||
"chai": "4.3.4",
|
"chai": "4.3.4",
|
||||||
"commander": "8.2.0",
|
"commander": "8.3.0",
|
||||||
"deepmerge": "4.2.2",
|
"deepmerge": "4.2.2",
|
||||||
"del": "6.0.0",
|
"del": "6.0.0",
|
||||||
"eslint": "7.32.0",
|
"eslint": "8.4.1",
|
||||||
"flatted": "3.2.2",
|
"flatted": "3.2.4",
|
||||||
"fs-extra": "10.0.0",
|
"fs-extra": "10.0.0",
|
||||||
"glob": "7.2.0",
|
"glob": "7.2.0",
|
||||||
"got": "11.8.2",
|
"got": "11.8.3",
|
||||||
"humanize-string": "2.1.0",
|
"humanize-string": "3.0.0",
|
||||||
"json-schema": "0.3.0",
|
"json-schema": "0.4.0",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"mustache": "4.2.0",
|
"mustache": "4.2.0",
|
||||||
"openapi-types": "9.3.0",
|
"openapi-types": "10.0.0",
|
||||||
"plantuml-encoder": "1.4.0",
|
"plantuml-encoder": "1.4.0",
|
||||||
|
"re2": "1.17.1",
|
||||||
"toposort": "2.0.2",
|
"toposort": "2.0.2",
|
||||||
"ts-json-schema-generator": "0.95.0",
|
"ts-json-schema-generator": "0.97.0",
|
||||||
"ts-node": "10.2.1",
|
"ts-node": "10.4.0",
|
||||||
"typescript": "4.4.3"
|
"typescript": "4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@openstapps/configuration": "0.28.1",
|
"@openstapps/configuration": "0.29.0",
|
||||||
"@testdeck/mocha": "0.1.2",
|
"@testdeck/mocha": "0.2.0",
|
||||||
"@types/chai": "4.2.22",
|
"@types/chai": "4.3.0",
|
||||||
"@types/fs-extra": "9.0.13",
|
"@types/fs-extra": "9.0.13",
|
||||||
"@types/glob": "7.1.4",
|
"@types/glob": "7.2.0",
|
||||||
"@types/json-schema": "7.0.9",
|
"@types/json-schema": "7.0.9",
|
||||||
"@types/lodash": "4.14.175",
|
"@types/lodash": "4.14.178",
|
||||||
"@types/mocha": "9.0.0",
|
"@types/mocha": "9.0.0",
|
||||||
"@types/mustache": "4.1.2",
|
"@types/mustache": "4.1.2",
|
||||||
"@types/node": "14.17.19",
|
"@types/node": "14.18.0",
|
||||||
"@types/rimraf": "3.0.2",
|
"@types/rimraf": "3.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "4.32.0",
|
"@typescript-eslint/eslint-plugin": "5.7.0",
|
||||||
"@typescript-eslint/parser": "4.32.0",
|
"@typescript-eslint/parser": "5.7.0",
|
||||||
"conventional-changelog-cli": "2.1.1",
|
"conventional-changelog-cli": "2.1.1",
|
||||||
"eslint-config-prettier": "8.3.0",
|
"eslint-config-prettier": "8.3.0",
|
||||||
"eslint-plugin-jsdoc": "36.1.0",
|
"eslint-plugin-jsdoc": "37.2.0",
|
||||||
"eslint-plugin-prettier": "4.0.0",
|
"eslint-plugin-prettier": "4.0.0",
|
||||||
"eslint-plugin-unicorn": "36.0.0",
|
"eslint-plugin-unicorn": "39.0.0",
|
||||||
"mocha": "9.1.2",
|
"mocha": "9.1.3",
|
||||||
"nock": "13.1.3",
|
"nock": "13.2.1",
|
||||||
"prepend-file-cli": "1.0.6",
|
"prepend-file-cli": "1.0.6",
|
||||||
"prettier": "2.4.1",
|
"prettier": "2.5.1",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"typedoc": "0.22.4"
|
"typedoc": "0.22.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {definitionsOf} from './easy-ast/ast-util';
|
|||||||
import {lightweightProjectFromPath} from './easy-ast/easy-ast';
|
import {lightweightProjectFromPath} from './easy-ast/easy-ast';
|
||||||
import {isSchemaWithDefinitions} from './util/guards';
|
import {isSchemaWithDefinitions} from './util/guards';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import re2 from './types/re2';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StAppsCore converter
|
* StAppsCore converter
|
||||||
@@ -65,7 +66,7 @@ export class Converter {
|
|||||||
this.generator = new SchemaGenerator(program, createParser(program, config), createFormatter(config));
|
this.generator = new SchemaGenerator(program, createParser(program, config), createFormatter(config));
|
||||||
|
|
||||||
// create Ajv instance
|
// create Ajv instance
|
||||||
this.schemaValidator = new Ajv();
|
this.schemaValidator = new Ajv({code: {regExp: re2}});
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires,unicorn/prefer-module
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,unicorn/prefer-module
|
||||||
this.schemaValidator.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
|
this.schemaValidator.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/types/re2.ts
Normal file
6
src/types/re2.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import re2 from 're2';
|
||||||
|
|
||||||
|
type Re2 = typeof re2 & {code: string};
|
||||||
|
(re2 as Re2).code = 'require("lib/types/re2").default';
|
||||||
|
|
||||||
|
export default re2 as Re2;
|
||||||
@@ -23,6 +23,7 @@ import {globPromisified, readFilePromisified, writeFilePromisified} from './comm
|
|||||||
import {ExpectedValidationErrors, ValidationError, ValidationResult} from './types/validator';
|
import {ExpectedValidationErrors, ValidationError, ValidationResult} from './types/validator';
|
||||||
import {isThingWithType} from './util/guards';
|
import {isThingWithType} from './util/guards';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import re2 from './types/re2';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StAppsCore validator
|
* StAppsCore validator
|
||||||
@@ -31,7 +32,11 @@ export class Validator {
|
|||||||
/**
|
/**
|
||||||
* JSON Schema Validator
|
* JSON Schema Validator
|
||||||
*/
|
*/
|
||||||
private readonly ajv = new Ajv({verbose: true});
|
private readonly ajv = new Ajv({
|
||||||
|
verbose: true,
|
||||||
|
ignoreKeywordsWithRef: true,
|
||||||
|
code: {regExp: re2},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of schema names to schemas
|
* Map of schema names to schemas
|
||||||
@@ -133,7 +138,7 @@ function fromAjvResult(
|
|||||||
const betterErrorObject: betterAjvErrors.IOutputError[] | undefined = betterAjvErrors(
|
const betterErrorObject: betterAjvErrors.IOutputError[] | undefined = betterAjvErrors(
|
||||||
schema,
|
schema,
|
||||||
instance,
|
instance,
|
||||||
ajvInstance.errors,
|
ajvInstance.errors ?? [],
|
||||||
// eslint-disable-next-line unicorn/no-null
|
// eslint-disable-next-line unicorn/no-null
|
||||||
{format: 'js', indent: null},
|
{format: 'js', indent: null},
|
||||||
);
|
);
|
||||||
@@ -145,10 +150,10 @@ function fromAjvResult(
|
|||||||
dataPath: ajvError.instancePath,
|
dataPath: ajvError.instancePath,
|
||||||
instance: instance,
|
instance: instance,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||||
message: betterErrorObject?.[index].error!,
|
message: betterErrorObject?.[index]?.error! ?? ajvError.message,
|
||||||
name: ajvError.keyword,
|
name: ajvError.keyword,
|
||||||
schemaPath: ajvError.schemaPath,
|
schemaPath: ajvError.schemaPath,
|
||||||
suggestion: betterErrorObject?.[index].suggestion,
|
suggestion: betterErrorObject?.[index]?.suggestion,
|
||||||
};
|
};
|
||||||
// (validationError as ValidationError).humanReadableError = betterErrorCLI?.[index] as unknown as string;
|
// (validationError as ValidationError).humanReadableError = betterErrorCLI?.[index] as unknown as string;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user