blob: 61f4c09c800ecb1fe67f0f60d933f63dd311d11b (
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);
}
}
|