Skip to main content

Import

import {
  defineSchema,
  lazySchema,
  schemaIsOptional,
  schemaToJsonSchema,
  CommonSchemas,
  getAbsolutePathSchema,
} from "veryfront/schemas";

Examples

import { CommonSchemas, defineSchema } from "veryfront/schemas";

const email = CommonSchemas.email.parse("user@example.com");

const getUserSchema = defineSchema((v) =>
  v.object({
    id: v.string().uuid(),
    name: v.string().min(1),
  })
);

Exports

Components

NameDescriptionSource
CommonSchemasLazy-getter object that preserves the CommonSchemas.email call shape. Each access returns the cached Schema<T> (memoized inside defineSchema), so chained calls like CommonSchemas.email.parse(x) work as before.source

Functions

NameDescriptionSource
defineSchemaWrap a schema factory so that it is built lazily on first call.source
lazySchemasource
schemaIsOptionalReturns true when the schema permits undefined.source
schemaToJsonSchemaConvert an opaque Schema<T> to a JSON Schema document.source

Types

NameDescriptionSource
AbsolutePathsource
DateRangesource
Emailsource
FilePathsource
HexColorsource
JsonSchemaMinimal JSON Schema type used by the SchemaValidator contract for toJsonSchema(). Kept in the extensions/schema category so the contract can reference it without depending on any non-leaf module.source
JsonValueRecursive JSON value type - a string, number, boolean, null, array of JsonValue, or object with string keys and JsonValue values.source
NonEmptyStringsource
NonNegativeIntsource
Paginationsource
PhoneNumbersource
PortNumbersource
PositiveIntsource
Semversource
Slugsource
StrongPasswordsource
Timestampsource
Urlsource
Uuidsource

Constants

NameDescriptionSource
getAbsolutePathSchemasource
getDateRangeSchemasource
getEmailSchemasource
getFilePathSchemasource
getHexColorSchemasource
getJsonValueSchemasource
getNonEmptyStringSchemasource
getNonNegativeIntSchemasource
getPaginationSchemasource
getPhoneNumberSchemasource
getPortNumberSchemasource
getPositiveIntSchemasource
getSemverSchemasource
getSlugSchemasource
getStrongPasswordSchemasource
getTimestampSchemasource
getUrlSchemasource
getUuidSchemasource