Closed nazarhussain closed 11 months ago
While upgrading Ajv to version 8.1.0. Its observed that ErrorObject introduced a couple of changes. To keep the backend compatibility we introduced a wrapper to covert the error object.
ErrorObject
https://github.com/LiskHQ/lisk-sdk/blob/c632e17a24e1a865fa6a14cb2147d24634e52f24/elements/lisk-validator/src/types.ts#L19-L22
https://github.com/LiskHQ/lisk-sdk/blob/c632e17a24e1a865fa6a14cb2147d24634e52f24/elements/lisk-validator/src/errors.ts#L40
We also have our own implementation of ErrorObject to single string conversion.
https://github.com/LiskHQ/lisk-sdk/blob/c632e17a24e1a865fa6a14cb2147d24634e52f24/elements/lisk-validator/src/errors.ts#L54
The Ajv in version 8.1.0 introduced ajv.errorText(errors) for the same purpose. We should move our implementation to this native function.
ajv.errorText(errors)
The above mentioned changes will provide us following benefits;
ajv
ajv-errors
ajv-i18n
LiskErrorObject
ajv.errorText
Closing this issue for no activity
Description
While upgrading Ajv to version 8.1.0. Its observed that
ErrorObject
introduced a couple of changes. To keep the backend compatibility we introduced a wrapper to covert the error object.https://github.com/LiskHQ/lisk-sdk/blob/c632e17a24e1a865fa6a14cb2147d24634e52f24/elements/lisk-validator/src/types.ts#L19-L22
https://github.com/LiskHQ/lisk-sdk/blob/c632e17a24e1a865fa6a14cb2147d24634e52f24/elements/lisk-validator/src/errors.ts#L40
We also have our own implementation of
ErrorObject
to single string conversion.https://github.com/LiskHQ/lisk-sdk/blob/c632e17a24e1a865fa6a14cb2147d24634e52f24/elements/lisk-validator/src/errors.ts#L54
The Ajv in version 8.1.0 introduced
ajv.errorText(errors)
for the same purpose. We should move our implementation to this native function.Motivation
The above mentioned changes will provide us following benefits;
ajv
without any compatibility issuesajv-errors
to specify custom error messages inside schema declarationajv-i18n
for internationlization of error messagesAcceptance Criteria
LiskErrorObject
should be removedajv.errorText
to get single string conversion of validation errorsAdditional Information