/gtfs-validator

GTFS Validator project for static (schedule) files from a zip archive

Primary LanguageJavaApache License 2.0Apache-2.0

gtfs-validator Java CI Join the gtfs-validator chat

A static General Transit Feed Specification (GTFS) feed validator

Introduction

This command-line tool written in Java that performs the following steps:

  1. Loads input GTFS zip file from a URL or disk
  2. Checks files integrity, numeric type parsing and ranges as well as string format according to the GTFS specification using this schema file
  3. Performs basic GTFS business rule validation (work-in-progress)

Prerequisites

  1. Install Java 11 or higher
  2. Download the latest gtfs-validator JAR file from our Releases page

Usage

Sample usage:

java -jar gtfs-validator-v1.1.0.jar -u https://transitfeeds.com/p/mbta/64/latest/download -z input.zip -e input -o output

...which will:

  1. Download the GTFS feed at the URL https://transitfeeds.com/p/mbta/64/latest/download and name it input.zip
  2. Extract the input.zip contents to the directory input
  3. Validate the GTFS data and output the results to the directory output. Validation results are exported to JSON by default.

For a list of all available commands, use --help:

java -jar gtfs-validator-v1.1.0.jar --help

Execution parameters are configurable through command-line or via a configuration file execution-parameters.json. By default, if no command-line is provided the validation process will look for execution parameters in user configurable configuration file execution-parameters.json. In the case said file could not be found or is incomplete, default values will be used.

As an example, the sample usage equivalent with configuration file

java -jar gtfs-validator-v1.1.0.jar

With execution-parameters.json file located in the working directory:

{
  "extract": "input",
  "output": "output",
  "url": "https://transitfeeds.com/p/mbta/64/latest/download",
  "zipinput": "input.zip"
}

Note that you'll need to change the above JAR file name to whatever release version you download.

Architecture

We use clean architecture principles to implement this validator, which modularizes the project.

Some important modules:

Tests

To run tests:

./gradlew check

License

Code licensed under the Apache 2.0 License.