blob: bd2f97d2b34a433c420423f4c4b9b420dd9f6340 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import {Validator, ValidatorResult} from 'jsonschema';
import {ECSignatureSchema, ECSignatureParameter} from '../schemas/ec_signature_schema';
export class SchemaValidator {
private validator: Validator;
constructor() {
this.validator = new Validator();
this.validator.addSchema(ECSignatureParameter, ECSignatureParameter.id);
this.validator.addSchema(ECSignatureSchema, ECSignatureSchema.id);
}
public validate(instance: object, schema: Schema): ValidatorResult {
return this.validator.validate(instance, schema);
}
}
|