csv-validator
csv-validator copied to clipboard
Different column order is not supported
If CSV schema has different order of columns then CSV header, error "Error: Metadata header, cannot find the column headers - - . (Case sensitive)" will be shown. This message is not user friendly and very hard to debug.
Steps: Given some CSV file and CSV schema with correct validation
- Change order of columns in schema or CSV file
Expected result: Information message is shown "PASSED" ( Or at least some meaningful error message)
Actual result: "Error: Metadata header, cannot find the column headers - - . (Case sensitive)" message is shown.
I can't find anything in the documentation that this is not supported. Ideally columns should be sorted and then verified. Or at least some meaningful message should be shown.
@azelenov I see that you are correct, it is not explicit in the CSV Schema language that columns in the CSV Schema should be specified in the same order as the CSV file itself. However, from my subjective reading of it, it does seem that this is implicit.
So I would suggest that the error messages could be improved, and that it should be made explicit in either the documentation of the implementation (CSV Validator) or the CSV Schema that column order in the CSV Schema should represent that of the CSV file to be validated.
I cannot see any value in allowing a non-linear ordering.
We'll review this and come back to you. Implicitly we were anticipating that the tests should appear in the same order that the columns are expected to be in the CSV file. For us that order is important due to how we transform the CSV into XML later in our workflow, but I appreciate that that might not always be the case. In the short term, we'll probably just make it explicit that the order of the tests and the order of the columns should match, but it could be made more flexible. We have Version 1.2 of the schema in draft, so changes would probably go into that.
+1