import { getSchemaUtils } from "../builders/schema-utils"; import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema"; import { maybeSkipValidation } from "./maybeSkipValidation"; export function createIdentitySchemaCreator( schemaType: SchemaType, validate: (value: unknown, opts?: SchemaOptions) => MaybeValid ): () => Schema { return () => { const baseSchema: BaseSchema = { parse: validate, json: validate, getType: () => schemaType, }; return { ...maybeSkipValidation(baseSchema), ...getSchemaUtils(baseSchema), }; }; }