| Crates.io | versa_semval |
| lib.rs | versa_semval |
| version | 0.7.2 |
| created_at | 2025-04-22 14:16:00.722552+00 |
| updated_at | 2025-06-20 23:00:06.509133+00 |
| description | Cross-platform module for semantic validation of Versa data |
| homepage | https://versa.org |
| repository | https://github.com/versa-protocol/semval |
| max_upload_size | |
| id | 1644103 |
| size | 182,515 |
This is a collection of rules, rule-evaluators, and tests for semantic validation of Versa receipts. Written in Rust, it uses napi-rs to compile to native modules for use in NodeJS environments. It can also be used in Rust backends, and is utilized by the Versa custodial service and official Docker images.
Install from npm:
npm install @versaprotocol/semval
In a NodeJS-runtime route handler:
import { runSemanticValidation } from "@versaprotocol/semval";
export async function POST(request: Request) {
const data = await request.json();
const semval = runSemanticValidation(data);
for (const violation of semval.violations) {
console.warn(`Semval Warning for rule ${violation.rule}: ${violation.description}`);
}
return new Response();
}
The native module is tested on a support matrix for NodeJS versions 20 and 22
One item to watch is napi-rs support for WASM targets, so that this could also be used in the browser
The below items are potential improvements to the semval module that have not yet been scheduled for development.