diff --git a/packages/typebox/src/index.ts b/packages/typebox/src/index.ts index 0362793145..2f338703c4 100644 --- a/packages/typebox/src/index.ts +++ b/packages/typebox/src/index.ts @@ -1,4 +1,13 @@ -import { Type, TObject, TInteger, TOptional, TSchema, ObjectOptions, TIntersect } from '@sinclair/typebox' +import { + Type, + TObject, + TInteger, + TOptional, + TSchema, + ObjectOptions, + TIntersect, + TUnion +} from '@sinclair/typebox' import { jsonSchema, Validator, DataValidatorMap, Ajv } from '@feathersjs/schema' export * from '@sinclair/typebox' @@ -17,8 +26,10 @@ export type TDataSchemaMap = { * @param validator The AJV validation instance * @returns A compiled validation function */ -export const getValidator = (schema: TObject | TIntersect, validator: Ajv): Validator => - jsonSchema.getValidator(schema as any, validator) +export const getValidator = ( + schema: TObject | TIntersect | TUnion, + validator: Ajv +): Validator => jsonSchema.getValidator(schema as any, validator) /** * Returns compiled validation functions to validate data for the `create`, `update` and `patch`