MobilityData / gbfs-validator

The canonical GBFS validator. Maintained by the GBFS community, facilitated by MobilityData.
https://gbfs-validator.mobilitydata.org/
Apache License 2.0
18 stars 12 forks source link

CLI or HTTP API? #53

Open AntoineAugusti opened 3 years ago

AntoineAugusti commented 3 years ago

Hello there!

Thanks for providing an awesome tool. We @ https://transport.data.gouv.fr are very interested in using/contributing to this repository (and we already did! #39)

We'd like to know if it's possible to use this tool as a CLI tool or an HTTP API.

It seems like we can use it as a CLI by doing

cd gbfs-validator
npm install
node cli.js https://transport.data.gouv.fr/gbfs/strasbourg/gbfs.json

which gives a JSON report

There is also an HTTP API available at https://gbfs-validator.netlify.app/.netlify/functions/validator

curl -X POST -d '{"url": "https://transport.data.gouv.fr/gbfs/strasbourg/gbfs.json"}' https://gbfs-validator.netlify.app/.netlify/functions/validator

Is this safe to use? Should this be documented?

PierrickP commented 3 years ago

Hello @AntoineAugusti

Yes both version are available. The main entry point was the website https://gbfs-validator.netlify.app/ (+ the api/lambda function). The cli was written to validate in batch the systems.csv file.

But, the api/lambda function nor the exposed JSON report are not intended to be used outside of this project. Breaking changes can be introduced later. After this warning, i think you can still use it as you want :) The validator is currently hosted on my personnal Netlify (free plan, limited to 125k requests/month) account and we are in the way to transfer it to MobilityData.

On the long-term roadmap, we planned to export a report (less breaking changes).

AntoineAugusti commented 3 years ago

Thanks a lot @PierrickP, I will keep that in mind! I think we'll use the HTTP API for now and we'll keep in mind that it can disappear or break.

We plan to make less than 3k HTTP requests per month and I will add a User-Agent: <email_address> to identify our requests. Thanks a lot for allowing us to use the Lambda outside this project.