Skip to content

Commit

Permalink
#
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed Jul 9, 2024
1 parent 989f2cb commit 14e38fd
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions tools/src/_utils/JsonSchemaValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default class JsonSchemaValidator {
private readonly ajv: AJV
private readonly errors_parser: AjvErrorsParser
private readonly _validate: ValidateFunction | undefined
errors: AjvError[] | null | undefined
message: string | undefined

constructor(schema: Record<any, any> | undefined, options: JsonSchemaValidatorOpts = {}) {
Expand All @@ -59,13 +58,7 @@ export default class JsonSchemaValidator {

#validate(validate_func: ValidateFunction, data: Record<any, any>): boolean {
const valid = validate_func(data) as boolean
if (valid) {
this.errors = undefined
this.message = undefined
} else {
this.errors = validate_func.errors
this.message = this.errors_parser.parse(this.errors)
}
this.message = valid ? undefined : this.errors_parser.parse(validate_func.errors)
return valid
}
}

0 comments on commit 14e38fd

Please sign in to comment.