You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
public validate<T = Record<string, unknown>>(schema: object, data: unknown): asserts data is T {
if (!this._validator.validate(schema, data)) {
throw new LiskValidationError(convertErrorsToLegacyFormat(this._validator.errors as LiskErrorObject[]));
}
}
public validateSchema(schema: object): asserts schema is SchemaObject {
if (!this._validator.validateSchema(schema)) {
throw new LiskValidationError(convertErrorsToLegacyFormat(this._validator.errors as LiskErrorObject[]));
}
}
Motivation
We should have type guard on the validate function so after this function, type is ensured
It should not be required to check error length
Additional Information
All usages needs to be updated
The text was updated successfully, but these errors were encountered:
Description
Currently, when using
validate
function,validator.validate<SomeType>(schema, params);
where error thrown is
LiskValidationError
, and params should beSomeType
after this functionhttps://github.dev/LiskHQ/lisk-sdk/blob/00595476a406f9413e77c7381803425d5d22cec9/elements/lisk-validator/src/lisk_validator.ts#L72-L87
Motivation
Additional Information
The text was updated successfully, but these errors were encountered: