Skip to content

feat(vaults): add Joi validation for vault configuration (#3) - #5

Open
Cid-oe wants to merge 1 commit into
Arbellar:mainfrom
Cid-oe:feat/vault-config-validation
Open

feat(vaults): add Joi validation for vault configuration (#3)#5
Cid-oe wants to merge 1 commit into
Arbellar:mainfrom
Cid-oe:feat/vault-config-validation

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Resolves #3.

Implements dedicated Joi validation for Vault configuration in the Arbellar Backend matching the Phase 1 Core MVP specification.

Changes

  • Created src/modules/vaults/vault.validation.ts:
    • vaultConfigSchema covering required fields (name, riskLevel, minSpread, maxSlippage, autoReinvest) and optional fields (description, tradeSizeLimit) with stripUnknown: true.
    • validateVaultConfig(config) returning cleaned data and throwing ValidationError on failure.
    • isValidVaultConfig(config) returning a boolean.
  • Added comprehensive unit tests in src/modules/vaults/vault.test.ts verifying happy path, unknown field stripping, missing required fields, invalid risk levels, negative bounds, and boolean type checking.
  • Updated vitest.config.ts to include test files in src/.
  • Updated src/modules/vaults/README.md to document the new validation helper functions and schema.

Validation

  • pnpm test passes (11 tests pass across suite).
  • pnpm typecheck passes cleanly.
  • pnpm format:check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(vaults): Add Joi Validation for Vault Configuration

1 participant