|
| 1 | +# GBFS-Validator |
| 2 | + |
| 3 | +[](http://badge.fury.io/js/gbfs-validator) |
| 4 | + |
| 5 | +GBFS Validator is a command-line tool for validating General Bikeshare Feed Specification (GBFS) data feed and outputing the report in a JSON file |
| 6 | + |
| 7 | +## Add the Dependency |
| 8 | + |
| 9 | +To use `gbfs-validator` in your own project, you need to |
| 10 | +first install our [Node.js npm package](https://www.npmjs.com/package/gbfs-validator): |
| 11 | + |
| 12 | +``` |
| 13 | +npm install gbfs-validator |
| 14 | +``` |
| 15 | + |
| 16 | +## Example Code |
| 17 | +``` |
| 18 | +const GBFS = require('gbfs-validator'); |
| 19 | +
|
| 20 | +const feedUrl = "https://gbfs.velobixi.com/gbfs/gbfs.json"; |
| 21 | +const feedOptions = {} |
| 22 | +const gbfs = new GBFS(feedUrl, feedOptions) |
| 23 | +
|
| 24 | +gbfs.validation().then((reportResults) => { |
| 25 | + // reportResults: GBFS Validation Report Results in JSON |
| 26 | +}).catch(error => { |
| 27 | + // error handling |
| 28 | +}) |
| 29 | +
|
| 30 | +gbfs.getFiles().then((gbfsFeedFiles) => { |
| 31 | + // gbfsFeedFiles: Info about GBFS feed |
| 32 | +}).catch(error => { |
| 33 | + // error handling |
| 34 | +}) |
| 35 | +``` |
| 36 | + |
| 37 | +## Usage of the Command Line Interface |
| 38 | + |
| 39 | +How to validate a feed and place the report in a located file |
| 40 | +``` |
| 41 | +gbfs-validator -u {http_address_of_gbfs_dataset} -s {local_path_to_output_report_file} |
| 42 | +``` |
| 43 | + |
| 44 | +## Example of the CLI |
| 45 | + |
| 46 | +``` |
| 47 | +gbfs-validator -u https://gbfs.velobixi.com/gbfs/gbfs.json -s ~/Documents/log.json |
| 48 | +``` |
| 49 | + |
| 50 | +## Options |
| 51 | + |
| 52 | +``` |
| 53 | +-v, --version: output the version number |
| 54 | +-u, --url <feed_url>: URL of the GBFS feed |
| 55 | +-vb, --verbose: Verbose mode prints debugging console logs |
| 56 | +-s, --save-report <report_path>: Local path to output report file |
| 57 | +-pr, --print-report <yes_no>: Print report to standard output (choices: "yes", "no", default: "yes") |
| 58 | +-h, --help: display help for command |
| 59 | +``` |
0 commit comments