File tree Expand file tree Collapse file tree 5 files changed +20
-42
lines changed Expand file tree Collapse file tree 5 files changed +20
-42
lines changed Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
1818*/
1919
2020export * from './errors'
21- export * from './validator'
21+ export type { Validator } from './validator'
2222export * as Validators from './validators'
Original file line number Diff line number Diff line change @@ -17,12 +17,28 @@ SPDX-License-Identifier: Apache-2.0
1717Copyright (c) OWASP Foundation. All Rights Reserved.
1818*/
1919
20+ import type { Version } from '../spec'
21+
2022export interface Validator {
2123 /**
2224 * Promise rejects with one of the following
2325 * - {@link Validation.NotImplementedError | NotImplementedError} when there is no validator available for `this.version`
2426 * - {@link Validation.MissingOptionalDependencyError | MissingOptionalDependencyError} when a required dependency was not installed
2527 * - {@link Validation.ValidationError | ValidationError} when `data` was invalid to the schema
2628 */
27- validate : ( data : any ) => Promise < void >
29+ validate : ( data : string ) => Promise < void >
30+ }
31+
32+ export abstract class BaseValidator implements Validator {
33+ readonly #version: Version
34+
35+ constructor ( version : Version ) {
36+ this . #version = version
37+ }
38+
39+ get version ( ) : Version {
40+ return this . #version
41+ }
42+
43+ abstract validate ( data : string ) : Promise < void >
2844}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import { readFile } from 'fs/promises'
2323
2424import { FILES } from '../../resources.node'
2525import { MissingOptionalDependencyError , NotImplementedError , ValidationError } from '../errors'
26- import { BaseValidator } from './_helpers '
26+ import { BaseValidator } from '../validator '
2727
2828let _ajv : Ajv | undefined
2929
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import { pathToFileURL } from 'url'
2323
2424import { FILES } from '../../resources.node'
2525import { MissingOptionalDependencyError , NotImplementedError , ValidationError } from '../errors'
26- import { BaseValidator } from './_helpers '
26+ import { BaseValidator } from '../validator '
2727
2828let _parser : typeof parseXml | undefined
2929
You can’t perform that action at this time.
0 commit comments