diff --git a/adminforth/modules/configValidator.ts b/adminforth/modules/configValidator.ts index 7cdce6cb2..a5e2033a9 100644 --- a/adminforth/modules/configValidator.ts +++ b/adminforth/modules/configValidator.ts @@ -321,9 +321,14 @@ export default class ConfigValidator implements IConfigValidator { if (!res.columns) { res.columns = []; } - res.columns = res.columns.map((inCol: AdminForthResourceColumnInputCommon) => { + res.columns = res.columns.map((inCol: AdminForthResourceColumnInputCommon, inColIndex) => { const col: Partial = { ...inCol, required: undefined, editingNote: undefined }; + // check for duplicate column names + if (res.columns.findIndex((c) => c.name === col.name) !== inColIndex) { + errors.push(`Resource "${res.resourceId}" has duplicate column name "${col.name}"`); + } + col.label = col.label || guessLabelFromName(col.name); //define default sortable if (!Object.keys(col).includes('sortable')) { col.sortable = !col.virtual; }