24
Validation

Partial Field Validation

Describe, resolve, and validate partial field subsets.

Describe and resolve fields

API signatures:

  • FormInstance::describeFields(): array
  • FormInstance::resolveField(string $identifier): ?array
  • FormInstance::exportableFields(): array
  • FormInstance::flattenExportableFields(): array
  • FormInstance::validateExportableHeaders(array $headers): array
  • FormInstance::mapExportableRow(array $row, bool $strict = true): array
  • FormManager::describeFields(string $formKey, ?string $version = null): array
  • FormManager::resolveField(string $formKey, string $identifier, ?string $version = null): ?array
  • FormManager::exportableFields(string $formKey, ?string $version = null): array
  • FormManager::flattenExportableFields(string $formKey, ?string $version = null): array
  • FormManager::validateExportableHeaders(string $formKey, array $headers, ?string $version = null): array
  • FormManager::mapExportableRow(string $formKey, array $row, ?string $version = null, bool $strict = true): array
  • ScopedFormManager::describeFields(string $formKey, ?string $version = null): array
  • ScopedFormManager::resolveField(string $formKey, string $identifier, ?string $version = null): ?array
  • ScopedFormManager::exportableFields(string $formKey, ?string $version = null): array
  • ScopedFormManager::flattenExportableFields(string $formKey, ?string $version = null): array
  • ScopedFormManager::validateExportableHeaders(string $formKey, array $headers, ?string $version = null): array
  • ScopedFormManager::mapExportableRow(string $formKey, array $row, ?string $version = null, bool $strict = true): array

Descriptor shape:

  • name (canonical key)
  • field_key, key, id, label (nullable)
  • type
  • required (bool)
  • rules (array)
  • options (array, empty when not relevant)
  • default (mixed)
  • lookup_keys (array<string>, ordered unique aliases used by resolver)

Exportable field shape:

  • id (stable identifier for export/import mappings)
  • path (logical path, including composite subfield paths like address.line1)
  • label (human-readable column label)
  • type (field type)
  • field_key, field_name, page_key
  • required, visible, disabled
  • composite (bool)
  • parent and subfield metadata for composite fields
  • rules and meta for import and validation consumers

Validate partial field subsets

API signatures:

  • FormInstance::validateFields(array $payload, array $onlyFields = [], ?string $locale = null): array
  • FormManager::validateFields(string $formKey, array $payload, array $onlyFields = [], ?string $version = null, ?string $locale = null): array
  • ScopedFormManager::validateFields(string $formKey, array $payload, array $onlyFields = [], ?string $version = null, ?string $locale = null): array

Behavior:

  • onlyFields = []: validate only keys present in payload that resolve to known fields
  • onlyFields != []: validate strictly the requested subset
  • identifiers in onlyFields may be aliases (name, field_key, key, id)
  • errors are returned by canonical name
  • unknown payload keys are ignored in this partial flow
  • unresolved identifiers in onlyFields return explicit per-identifier errors