File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ export function evalAdditionalColumns(
239239 if ( context . extension !== '.tsv' ) return
240240 const headers = Object . keys ( context ?. columns )
241241 if ( rule . columns ) {
242+ if ( ! rule . additional_columns || rule . additional_columns === 'n/a' ) {
243+ // Old schemas might be missing the field, so be permissive.
244+ // New schemas indicate it is not applicable with 'n/a'.
245+ return
246+ }
242247 const ruleHeadersNames = Object . keys ( rule . columns ) . map (
243248 // @ts -expect-error
244249 ( x ) => schema . objects . columns [ x ] . name ,
@@ -250,11 +255,11 @@ export function evalAdditionalColumns(
250255 if ( rule . additional_columns ?. startsWith ( 'allowed' ) ) {
251256 extraCols = extraCols . filter ( ( header ) => ! ( header in context . sidecar ) )
252257 }
253- const code = rule . additional_columns === 'allowed '
254- ? 'TSV_ADDITIONAL_COLUMNS_UNDEFINED '
258+ const code = rule . additional_columns === 'not_allowed '
259+ ? 'TSV_ADDITIONAL_COLUMNS_NOT_ALLOWED '
255260 : rule . additional_columns === 'allowed_if_defined'
256261 ? 'TSV_ADDITIONAL_COLUMNS_MUST_DEFINE'
257- : 'TSV_ADDITIONAL_COLUMNS_NOT_ALLOWED '
262+ : 'TSV_ADDITIONAL_COLUMNS_UNDEFINED '
258263 const issue = {
259264 code,
260265 location : context . path ,
You can’t perform that action at this time.
0 commit comments