framework icon indicating copy to clipboard operation
framework copied to clipboard

Improve error message: data file with an empty header line above headers are not supproted (using schema-sync)

Open amelie-rondot opened this issue 2 years ago • 0 comments

Overview

Using frictionless cli to validate a CSV file containing an empty line above headers, I got this error:

frictionless validate --schema schema.json empty-first-line-above-headers.csv --schema-sync 

# -------
# invalid: empty-first-line-above-headers.csv 
# -------

===  =====  =============  =============================================================================
row  field  code           message                                                                      
===  =====  =============  =============================================================================
            general-error  General error: Duplicate labels in header is not supported with "schema_sync"
===  =====  =============  =============================================================================

The error lies to duplicate labels in the csv file instead of blank labels (as it does with --no-schema-sync). I was expecting a more explicit error message from frictionless.

Resources

  • schema.json
{
  "fields": [{ "name": "A" }, { "name": "B" }, { "name": "C" }]
}
  • empty-first-line-above-headers.csv

A,B,C
a,b,c

Note

Encountered problem is relative to --sync-schema option usage. Removing this option, errors are way more explicit:

frictionless validate --schema schema.json empty-first-line-above-headers.csv
# -------
# invalid: empty-first-line-above-headers.csv 
# -------

===  =====  ===========  =====================================================
row  field  code         message                                              
===  =====  ===========  =====================================================
         1  blank-label  Label in the header in field at position "1" is blank
         2  blank-label  Label in the header in field at position "2" is blank
         3  blank-label  Label in the header in field at position "3" is blank
===  =====  ===========  =====================================================

amelie-rondot avatar Nov 29 '22 10:11 amelie-rondot