mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 08:02:55 +00:00
fix: ajv related tranistive build errors
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import Ajv from 'ajv';
|
||||
import betterAjvErrors from 'better-ajv-errors';
|
||||
import betterAjvErrors, {IOutputError} from 'better-ajv-errors';
|
||||
import {PathLike} from 'fs';
|
||||
import {JSONSchema7} from 'json-schema';
|
||||
import * as mustache from 'mustache';
|
||||
@@ -34,7 +34,6 @@ export class Validator {
|
||||
*/
|
||||
private readonly ajv = new Ajv({
|
||||
verbose: true,
|
||||
ignoreKeywordsWithRef: true,
|
||||
code: {regExp: re2},
|
||||
});
|
||||
|
||||
@@ -134,8 +133,7 @@ function fromAjvResult(
|
||||
instance: unknown,
|
||||
ajvInstance: Ajv,
|
||||
): ValidationResult {
|
||||
// @ts-expect-error function can return void, which at runtime will be undefined. TS doesn't allow to assign void to undefined
|
||||
const betterErrorObject: betterAjvErrors.IOutputError[] | undefined = betterAjvErrors(
|
||||
const betterErrorObject: IOutputError[] | undefined = betterAjvErrors(
|
||||
schema,
|
||||
instance,
|
||||
ajvInstance.errors ?? [],
|
||||
@@ -149,8 +147,7 @@ function fromAjvResult(
|
||||
const error: ValidationError = {
|
||||
dataPath: ajvError.instancePath,
|
||||
instance: instance,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
message: betterErrorObject?.[index]?.error! ?? ajvError.message,
|
||||
message: betterErrorObject?.[index]?.error ?? ajvError.message,
|
||||
name: ajvError.keyword,
|
||||
schemaPath: ajvError.schemaPath,
|
||||
suggestion: betterErrorObject?.[index]?.suggestion,
|
||||
|
||||
Reference in New Issue
Block a user