-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
It seems like the TypeBox adapter is not respecting global settings. In my example I've got a simple email validator:
import { FormatRegistry } from "@sinclair/typebox";
FormatRegistry.Set("demo", () => true);Now if you try to use it via TypeBox wrap:
import { Type } from "@sinclair/typebox";
import { wrap } from "@typeschema/typebox";
const schema = Type.String({ format: "demo" });
const wrapped = wrap(schema);
const result = wrapped.validate("test_string");
// Throws: "Unknown format 'email'"My first suspicion would be that the dynamic import inside @typeschema/typebox conflicts with the global module configuration in my node application:
const importValidationModule = memoize(async () => {
const {TypeCompiler} = await import('@sinclair/typebox/compiler');
return {TypeCompiler};
});Versions:
Node: 20
"@sinclair/typebox": "0.33.7",
"@typeschema/typebox": "0.13.4"Metadata
Metadata
Assignees
Labels
No labels