Skip to content

Commit b45b5bd

Browse files
committed
feat: register custom data type as schema
1 parent ae28653 commit b45b5bd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ts/src/map/datatype.map.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {zodToRules, zodToTypeString} from "../internal/zod-schema";
1+
import {registerSchema, zodToRules, zodToTypeString} from "../internal/zod-schema";
22
import type {Translation} from "../types";
33
import type {DataTypeClass, DataTypeProps} from "../models/datatype.model";
44

@@ -14,6 +14,8 @@ export const dataTypeMap = (klass: DataTypeClass): DataTypeProps => {
1414
const schema = Reflect.getMetadata('hercules:schema', klass);
1515
if (!schema) throw new Error(`Data type class ${klass.name} is missing a schema. Add @Schema(z.string()) to the class.`);
1616

17+
registerSchema(schema, identifier);
18+
1719
return {
1820
identifier,
1921
type: zodToTypeString(schema),

0 commit comments

Comments
 (0)