foundation-forms.generatecsvtemplate
Home > @genesislcap/foundation-forms > generateCsvTemplate
generateCsvTemplate() function
Generates a CSV template string with headers and sample data based on JSON schema. If a UI schema is provided, it will be used to determine which fields to include and in what order. Hidden fields in the UI schema will be excluded.
Signature:
export declare function generateCsvTemplate(schema: JSONSchema7 | undefined, uiSchema?: UiSchema, includeOptionalFields?: boolean, includeBom?: boolean): string;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
schema |
JSONSchema7 | undefined |
The JSON schema defining the fields |
|
uiSchema |
(Optional) Optional UI schema to determine field order and visibility | |
|
includeOptionalFields |
boolean |
(Optional) Whether to include optional fields when no UI schema (default: true) |
|
includeBom |
boolean |
(Optional) Whether to prepend UTF-8 BOM for Excel compatibility (default: true) |
Returns:
string
The CSV template string with headers and one sample row