0

I am using the UK National Archives CSV Validator via the Maven dependency uk.gov.nationalarchives:csv-validator-java-api-1.4.0.jar to validate both the headers and the body of CSV/txt files.

I am using a .csvs file as a schema validation declaration containing the following rules:

version 1.1
@separator ','
@totalColumns 2
uuid: notEmpty and regex("validRegex")
endDate: empty or validDateTime

I want to make the endDate column entirely optional. This means the file should pass validation whether the endDate column is completely missing from the header and rows, or if it is present but empty or matching a date.

I removed the @totalColumns 2 line and attempted to use the @optional directive in various ways, but all failed with syntax or parsing errors:

  • endDate: @optional empty or validDateTime

  • endDate: empty or validDateTime @optional

  • Placing @optional on the line above the column name

  • endDate: @optional(empty or validDateTime)

How do I properly declare a column as fully optional (both missing header and missing content) in a .csvs schema file for this library?

2
  • "The core CSV Schema Language (developed by The National Archives) does not currently support optional column headers." according to Google AI at least Commented yesterday
  • This indeed is what the AIs have sadly told me aswell but I hoped maybe someone with some experience with this might have a trick under their sleeve and have a solution. Commented yesterday

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.