Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI or http for local gbfs files #70

Closed
aswinthomas opened this issue Mar 29, 2022 · 2 comments
Closed

CLI or http for local gbfs files #70

aswinthomas opened this issue Mar 29, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@aswinthomas
Copy link

aswinthomas commented Mar 29, 2022

Would it be possible to use the cli for validating gbfs files that are not hosted anywhere? For example:

node cli.js ~/Downloads/gbfs.json

The workaround I use now is using a local server python3 -m SimpleHTTPServer 8000

Also the example referenced in Issue #53 does not seem to work anymore (commit 35a2299)

node cli.js https://transport.data.gouv.fr/gbfs/strasbourg/gbfs.json
gbfs-validator/gbfs-validator/gbfs.js:63
      lang.body?.data?.vehicle_types.map(vt => {
                ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (gbfs-validator/gbfs-validator/index.js:1:14)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
@PierrickP
Copy link
Collaborator

Hello @aswinthomas

For the second point, check your node version. For optionnal chaining (the ?., https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) you need at least, node 14 (LTS is 16.x)

Yes validate offline feed can be a good functunality 👍

@isabelle-dr isabelle-dr added the enhancement New feature or request label Mar 29, 2022
isabelle-dr added a commit that referenced this issue Mar 30, 2022
…2044

5e02044 Fix type (#70)

git-subtree-dir: gbfs-validator/versions/schemas
git-subtree-split: 5e02044c90491f2e2804b619b8030692b39cf4a0
@richfab
Copy link
Contributor

richfab commented Oct 18, 2023

UPDATE: I had to change the workaround to python3 -m http.server 8000 for it to work. I was then able to use the CLI on a local GBFS feed: node cli -u http://localhost:8000/<Local path to the GBFS feed>

Moving the discussion to #70. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants