Configuration for field mapping in data transformation

interface FieldMapping {
    from: string;
    to: string;
    transform?: string | ((value) => any);
    required?: boolean;
    default?: any;
}

Properties

from: string

Source field path (dot notation supported, e.g., 'data.user.name')

to: string

Target field name in the model

transform?: string | ((value) => any)

Optional transformation to apply Built-in: 'string', 'number', 'boolean', 'date', 'json' Custom: function name or transformer function

Type declaration

    • (value): any
    • Parameters

      • value: any

      Returns any

required?: boolean

Whether this field is required

default?: any

Default value if field is missing