A static General Transit Feed Specification (GTFS) feed validator
This command-line tool written in Java that performs the following steps:
- Loads input GTFS zip file from a URL or disk
- Checks files integrity, numeric type parsing and ranges as well as string format according to the GTFS specification using this schema file
- Performs basic GTFS business rule validation (work-in-progress)
- Install Java 11 or higher
- Download the latest gtfs-validator JAR file from our Releases page
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:
- Download the GTFS feed at the URL
https://transitfeeds.com/p/mbta/64/latest/download
and name itinput.zip
- Extract the
input.zip
contents to the directoryinput
- 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.
We use clean architecture principles to implement this validator, which modularizes the project.
Some important modules:
- Domain - Entity classes
- Use cases - Business logic
- Adapters - Convertors (e.g., parsers and exporters)
- application/cli-app - The main command-line application
To run tests:
./gradlew check
Code licensed under the Apache 2.0 License.