@apideposu/tr-validation-zod
v0.1.0
Published
Optional Zod adapter package for @apideposu/tr-validation.
Maintainers
Readme
@apideposu/tr-validation-zod
@apideposu/tr-validation-zod is an optional Zod adapter package for @apideposu/tr-validation.
It reuses the core package's local-only structural validation and normalization logic. It does not perform official verification, registry lookup, backend calls, or telemetry.
Install
npm install @apideposu/tr-validation @apideposu/tr-validation-zod zodWhat it provides
- Zod schemas for stable core validators
- optional normalized-output transforms
- optional full-result transforms
- localized reason messages via
getReasonMessage
Usage
import { z } from "zod";
import {
ibanSchema,
phoneSchema,
tcknSchema,
} from "@apideposu/tr-validation-zod";
const schema = z.object({
tckn: tcknSchema({ output: "normalized" }),
iban: ibanSchema({ output: "normalized" }),
phone: phoneSchema({ output: "result" }),
});
const result = schema.parse({
tckn: "100 000 001-46",
iban: "TR62 0001 0012 3456 7890 1234 56",
phone: "0532 123 45 67",
});Available adapters
tcknSchema()vknSchema()ibanSchema()plateSchema()phoneSchema()provinceSchema()districtSchema()createValidationSchema()for wrapping additional core validators
Output modes
By default, schemas validate and return the original input string.
You can change that with output:
"input"- return the original input"normalized"- returnresult.normalized"result"- return the full result object from@apideposu/tr-validation
Local-only boundaries
- no API Deposu backend call
- no network call
- no registry lookup
- not official verification
- structural validation and normalization only
Development
npm test
npm run build