import type { SchemaFieldValueType } from '@overture-stack/lectern-dictionary'; import type { FieldRestrictionRule } from '../validateField/FieldRestrictionRule'; import type { RestrictionTestInvalidInfo } from '../validateField/FieldRestrictionTest'; export type FieldValidationErrorRestrictionInfo = RestrictionTestInvalidInfo & { restriction: FieldRestrictionRule; }; export type FieldValidationErrorRestrictions = { reason: 'INVALID_BY_RESTRICTION'; errors: Array; }; /** * This is the result when the value does not match the value type defined in the field. The properties * `valueType` and `isArray` are the expected type values as defined in the field definition. */ export type FieldValidationErrorValueType = { reason: 'INVALID_VALUE_TYPE'; valueType: SchemaFieldValueType; isArray: boolean; }; export type FieldValidationError = FieldValidationErrorRestrictions | FieldValidationErrorValueType;