Skip to content

About

Web and command-line application supported by the European Commission’s DIGIT for the validation of CSV data.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

2 watching

Forks

Banner

CSV validator

BuildStatus Security Rating Maintainability Rating Reliability Rating Vulnerabilities Bugs licence docs reports Gurubase docker

The CSV validator is a web application that validates CSV data against Table Schema. Its core is fully reusable: configuration alone determines the supported specifications, the validation types and other customisations. You can validate content through:

  • A web form, for validation through the user interface.
  • A REST API, for machine-to-machine integrations.
  • A SOAP API, for contract-based machine-to-machine integrations.

The SOAP API conforms to the GITB validation service API. This lets you use the validator in GITB Test Description Language (TDL) conformance test cases, as a verify step handler. You can also build the validator as a command-line tool (an executable JAR) with pre-packaged or provided configuration.

This validator is maintained by the European Commission's DIGIT and specifically the Interoperability Test Bed, a conformance testing service for projects involved in the delivery of cross-border public services. Learn more on the Interoperability Test Bed page.

Quick start

With Docker installed, run:

docker run -p 8080:8080 isaitb/csv-validator

Then open http://localhost:8080/csv/any/upload, upload a CSV file and its Table Schema, and validate. The generic any domain you see here has no built-in validation artefacts, so you provide your own schema.

To validate against your own preconfigured schemas, see Configuration.

How it works

The validator is a generic core that you configure to validate any supported specification. Configuration is organised in domains: logically separate setups served by the same application instance. Each domain defines:

  • The validation types it offers and their options.
  • The validation artefacts needed for validation, which can be local, remote or user-provided.

A domain's configuration lives in a folder containing a configuration property file and any other resources it needs.

The Test Bed's CSV validation guide documents setup and configuration as a step-by-step tutorial.

Running the validator

Prebuilt packages

If you don't plan to modify the validator's source, use the Test Bed's packages:

Endpoints

Once the web application is running, it is available at:

Channel URL
Web form http://localhost:8080/csv/DOMAIN/upload
REST API http://localhost:8080/csv/DOMAIN/api/validate (Swagger docs: http://localhost:8080/csv/swagger-ui/index.html)
SOAP API http://localhost:8080/csv/soap/DOMAIN/validation?wsdl

DOMAIN is the name of a domain's configuration folder under your validator.resourceRoot. You can change it by providing validator.domainName.DOMAIN mapping(s). These are application-level configuration properties that you can set in the default application.properties, or through environment variables and system properties.

Configuration

To run the validator you need a few basic properties. Set them as environment variables or system properties (see the full list of configuration properties):

Property Purpose
validator.resourceRoot The root folder from which all domain configurations are loaded.
logging.file.path The validator's log output folder.
validator.tmpFolder The validator's temporary work folder.

Within validator.resourceRoot, add a folder for each domain, with its configuration property file and any other resources. The CSV validation guide's configuration step includes a simple example you can download and reuse.

If you don't load any configuration, the validator falls back to a generic configuration with a single domain called any. It has no validation artefacts, so you upload your own schemas through the UI and APIs. Open it like any other domain, at http://localhost:8080/csv/any/upload.

Custom Docker image

To build your own image, use the sample Dockerfile as a starting point:

  1. Create a folder and copy into it the Dockerfile and the JAR produced by the csvvalidator-war module.
  2. (Optional) Create a sub-folder (for example resources) as your resource root, and place your domain configuration folder(s) in it.
  3. (Optional) Adapt the Dockerfile to copy the resources folder and set it as the validator.resourceRoot:
COPY resources /validator/resources/
ENV validator.resourceRoot=/validator/resources/

If you skip steps 2 and 3, only the generic validator is available, under the any domain.

Building from source

The validator is a multi-module Maven project. The artefact to use is the all-in-one Spring Boot web application produced by the csvvalidator-war module.

Prerequisites

  • A JDK installation (17+).
  • Maven (3+).
  • The itb-commons libraries, installed in your local Maven repository.

All dependencies are on public repositories except the itb-commons libraries, which are shared by all Test Bed validators and are not published publicly. Install them first:

git clone https://github.com/ISAITB/itb-commons.git
cd itb-commons
mvn install -DskipTests=true

Build

git clone https://github.com/ISAITB/csv-validator.git
cd csv-validator
mvn clean install

The web application is csvvalidator-war/target/validator.jar. Run it with the basic properties, for example:

java -Dvalidator.resourceRoot=/path/to/resources \
     -Dlogging.file.path=/path/to/logs \
     -Dvalidator.tmpFolder=/path/to/tmp \
     -jar csvvalidator-war/target/validator.jar

Plugin development

The CSV validator supports custom plugins that extend the validation report. Plugins are implementations of the GITB validation service API and must be built as "all-in-one" JARs.

Input to plugins

The validator calls plugins in sequence, passing the following input:

Input name Type Description
contentToValidate String The absolute and full path to the input provided to the validator.
domain String The validation domain relevant to the specific validation call.
validationType String The validation type of the domain that is selected for the specific validation call.
tempFolder String The absolute and full path to a temporary folder for plugins. This will be automatically deleted after all plugins complete validation.
hasHeaders String true or false depending on whether the input should be considered as having a header row.
delimiter String The character to use as the field delimiter.
quote String The character to use for the quote character.
locale String The locale (language code) to use for reporting of results (e.g. "fr", "fr_FR").

Output from plugins

A plugin's output is a GITB ValidationResponse that wraps a TAR instance. The report items in this TAR are merged with the reports produced by Table Schema validation.

Plugin configuration

Plugin configuration is part of a validator's domain configuration. Once your plugins are implemented, configure them with the validator.defaultPlugins and validator.plugins properties, listing for each plugin:

  • The path to its JAR file.
  • The fully qualified class name of its entry point.

Security

To report a security vulnerability, please follow this repository's security policy.

To support transparency and the security monitoring needs of downstream users, signed Software Bill of Materials (SBOM) and Vulnerability Disclosure Report (VDR) documents in CycloneDX format are published for every release of the CSV validator in the release-reports repository:

Contributing

The best way to contribute is to share your feedback, questions and suggestions by opening an issue in this repository. For more elaborate contributions, and for more information, see CONTRIBUTING.md.

Licence

This software is shared using the European Union Public Licence (EUPL) version 1.2.

Third-party library licences and attributions are listed in NOTICE.md.

Legal notice

The authors of this software waive any and all liability linked to its usage or the interpretation of results it produces.

Contact

For feedback or questions about this validator, please post an issue in this repository. You can also contact the Test Bed team by email at DIGIT-ITB@ec.europa.eu.

See also

The Test Bed provides similar validators for other content types. Check these out for more information:

About

Web and command-line application supported by the European Commission’s DIGIT for the validation of CSV data.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages