Skip to content

API Reference

TypeScript types

All core public types are exported from the package root:

ts
import type {
  // Field schema
  FieldDefinition,
  FieldType,
  FieldOption,

  // Masking
  MaskConfig,
  MaskPreset,

  // Validation
  ValidatorFn,
  AsyncValidatorFn,

  // useForm
  UseFormConfig,
  UseFormReturn,
  ValidateOn,
  ValidateMode,

  // Schema adapters
  TypedFieldDefinitions,
  JSONSchema,
  JSONSchemaField,
  BuiltinRule,
  InferValues,

  // Custom components / registry
  FormFieldProps,
  ComponentMap,

  // useFieldArray
  FieldArrayRow,
  UseFieldArrayReturn,

  // useMultiStepForm
  MultiStepFormReturn,

  // useFormDebug
  FormSnapshot,

  // Server errors
  NormalizedServerErrors,
  ServerErrorFormat,
  ServerErrorMapper,
  ApplyServerErrorsOptions,
} from '@macrulez/vue-form-schema'

The /openapi entry point exports its own additional types, not re-exported from the root (they only matter if you call parseJSONSchema/parseOpenAPI directly):

ts
import type {
  JSONSchemaObject,
  JSONSchemaDocument,
  InferJSONSchema,
  OpenAPISchemaSelector,
  OpenAPIRequestBodySelector,
} from '@macrulez/vue-form-schema/openapi'

Path utilities

Low-level dot-path helpers, used internally by useForm/useFieldArray and exported for anyone building their own field-value plumbing outside the built-in composables.

getByPath

(obj: Record<string, unknown>, path: string) => unknown

Reads a nested value by dot-path — getByPath({ address: { city: 'NY' } }, 'address.city') returns 'NY'. Returns undefined for a missing or non-object intermediate segment, never throws.

setByPath

(obj: Record<string, unknown>, path: string, value: unknown) => Record<string, unknown>

Writes a nested value by dot-path, creating intermediate objects as needed, and returns the (mutated) object.

ts
import { getByPath, setByPath } from '@macrulez/vue-form-schema'

const values = { address: { city: 'NY' } }
getByPath(values, 'address.city') // 'NY'
setByPath(values, 'address.zip', '10001')
// values is now { address: { city: 'NY', zip: '10001' } }