kleros-v2
kleros-v2 copied to clipboard
feat: use zod directly for validating dispute templates
This is a WIP:
For now, only escrow v2 and curate v2 disputes render, and all the other ones don't since they don't adhere to the validations I put (which are provisional ones). I think we need to decide on a more robust dispute template specification (which fields exactly the templates will have), and use that dispute template everywhere (on the Dispute Resolver, and on the arbitrables' dispute templates). Also document this once its done so the integrations are very easy.
I've put some logs detailing exactly why the template validation failed in case it did.
Summary by CodeRabbit
-
New Features
- Enhanced validation with new
isHexAddressandisHexIdfunctions.
- Enhanced validation with new
-
Improvements
- Made several fields optional in schemas to increase flexibility (e.g.,
attachment,metadata,lang).
- Made several fields optional in schemas to increase flexibility (e.g.,
-
Refactor
- Updated validation logic to use
DisputeDetailsSchemafor improved consistency and error handling.
- Updated validation logic to use
PR-Codex overview
This PR updates dispute details validation by replacing DisputeDetailsValidator with DisputeDetailsSchema for better error handling and adds optional fields to various schemas.
Detailed summary
- Replaced
DisputeDetailsValidatorwithDisputeDetailsSchemafor validation - Added optional fields to
AnswerSchemaandAliasSchema - Made
attachment,metadata,arbitrableAddress,arbitratorAddress,lang,specificationoptional inDisputeDetailsSchema
✨ Ask PR-Codex anything about this PR by commenting with
/codex {your question}