From now on, you can add custom validation function utilizing comment tags like below:
typia.customValidators.insert("powerOf")("number")(
(text: string) => {
const denominator: number = Math.log(Number(text));
return (value: number) => {
value = Math.log(value) / denominator;
return value === Math.floor(value);
};
}
);
typia.customValidators.insert("dollar")("string")(
() => (value: string) => value.startsWith("$"),
);
interface TagCustom {
/**
* @powerOf 10
*/
powerOf: number;
/**
* @dollar
*/
dollar: string;
}
What's Changed
- Fix #557 - infinite generation when nested output path by @samchon in #566
- Close #560 - support custom validation tags by @samchon in #567
- Fix #455 - exact error message when comment tag comes by @samchon in #568
- Complement #560 - determine custom validator spec by @samchon in #569
- Benchmark stringify functions, especially vs
class-transformer
by @samchon in #571
Full Changelog: v3.6.9...v3.7.0