Expand description
Beancount validation rules.
This crate implements validation checks for beancount ledgers:
- Account lifecycle (opened before use, not used after close)
- Balance assertions
- Transaction balancing
- Currency constraints
- Booking validation (lot matching, sufficient units)
§Error Codes
All error codes follow the spec in spec/validation.md:
| Code | Description |
|---|---|
| E1001 | Account not opened |
| E1002 | Account already open |
| E1003 | Account already closed |
| E1004 | Account close with non-zero balance |
| E1005 | Invalid account name |
| E2001 | Balance assertion failed |
| E2002 | Balance exceeds explicit tolerance |
| E2003 | Pad without subsequent balance |
| E2004 | Multiple pads for same balance |
| E3001 | Transaction does not balance |
| E3002 | Multiple missing amounts in transaction |
| E3003 | Transaction has no postings |
| E3004 | Transaction has single posting (warning) |
| E4001 | No matching lot for reduction |
| E4002 | Insufficient units in lot |
| E4003 | Ambiguous lot match |
| E4004 | Reduction would create negative inventory |
| E5001 | Currency not declared |
| E5002 | Currency not allowed in account |
| E6001 | Duplicate metadata key |
| E6002 | Invalid metadata value |
| E7001 | Unknown option |
| E7002 | Invalid option value |
| E7003 | Duplicate option |
| E8001 | Document file not found |
| E10001 | Date out of order (info) |
| E10002 | Entry dated in the future (warning) |
Structs§
- Ledger
State - Ledger state for validation.
- Validation
Error - A validation error.
- Validation
Options - Validation options.
Enums§
Functions§
- validate
- Validate a stream of directives.
- validate_
with_ options - Validate a stream of directives with custom options.