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

Feat/Github submodules for gbfs schemas #187

Merged
merged 5 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/publish_validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ functions/*.zip

.env

# schemas

gbfs-validator/versions/schemas/.*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "gbfs-validator/versions/gbfs-json-schema"]
path = gbfs-validator/versions/gbfs-json-schema
url = https://github.com/MobilityData/gbfs-json-schema.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This tool is built using the [JSON Schemas](https://github.com/MobilityData/gbfs

![interface](https://github.com/MobilityData/gbfs-validator/assets/2423604/11206e7a-dd64-4133-bb32-eaa391815e60)

The schemas in `gbfs-validator/versions/schemas` is a git subtree of https://github.com/MobilityData/gbfs-json-schema. For more details, see [`gbfs-validator/versions/schemas/README.md`](https://github.com/MobilityData/gbfs-validator/tree/master/gbfs-validator/versions).
The schemas in `gbfs-validator/versions/gbfs-json-schema` is a git submodule of https://github.com/MobilityData/gbfs-json-schema.

Questions? Please open an issue or reach out on the #gbfs channel on the [MobilityData Slack](https://mobilitydata-io.slack.com/).

Expand Down
2 changes: 1 addition & 1 deletion gbfs-validator/gbfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class GBFS {
let schema

try {
schema = require(`./versions/schemas/v${version}/${file}`)
schema = require(`./versions/gbfs-json-schema/v${version}/${file}`)
} catch (e) {
console.log(e)
throw new Error('can not require')
Expand Down
8 changes: 6 additions & 2 deletions gbfs-validator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gbfs-validator",
"version": "1.0.9",
"version": "1.0.10",
"author": "MobilityData",
"main": "index.js",
"license": "MIT",
Expand All @@ -19,7 +19,8 @@
"gbfs-validator": "./cli.js"
},
"scripts": {
"test": "jest"
"test": "jest",
"postinstall": "git submodule update --init --recursive"
},
"dependencies": {
"ajv": "^8.9.0",
Expand All @@ -42,6 +43,9 @@
"!**/coverage/**",
"!**/__test__/**",
"!**/schema/**"
],
"testPathIgnorePatterns": [
"versions/gbfs-json-schema/"
]
}
}
14 changes: 5 additions & 9 deletions gbfs-validator/versions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ This folder contains json schemas from `MobilityData/gbfs-json-schema` and addit

## JSON schemas

The `schemas` folder contains a [git subtree](https://www.atlassian.com/git/tutorials/git-subtree) of https://github.com/MobilityData/gbfs-json-schema.
The `schemas` folder contains a [git submodule](https://www.atlassian.com/git/tutorials/git-submodule) of https://github.com/MobilityData/gbfs-json-schema.

You can pull schema update by using the command `git subtree pull --prefix gbfs-validator/versions/schemas https://github.com/MobilityData/gbfs-json-schema.git master --squash`
You can pull schema update by using the command `git submodule update --init --recursive`

### Contributing back
## gbfs-json-schema

If you want to push a contribution to the schemas sub-project (`MobilityData/gbfs-json-schema`), you can use the command
This directory is a git submodule, making changes in this directory is not recommended

```
git subtree push --prefix=gbfs-validator/versions/schemas/ https://github.com/MobilityData/gbfs-json-schema.git BRANCH
```
If you would like to make changes to `gbfs-json-schema` it is recommended to make a pull request from the original repository [gbfs-json-schema](https://github.com/MobilityData/gbfs-json-schema)

:warning: You probably don't have write access on `MobilityData/gbfs-json-schema`.
Please, fork it before and replace the repository url with your forked repository url.
1 change: 1 addition & 0 deletions gbfs-validator/versions/gbfs-json-schema
Submodule gbfs-json-schema added at 975f1d
2 changes: 0 additions & 2 deletions gbfs-validator/versions/schemas/.gitattributes

This file was deleted.

2 changes: 0 additions & 2 deletions gbfs-validator/versions/schemas/README.md

This file was deleted.

60 changes: 0 additions & 60 deletions gbfs-validator/versions/schemas/v1.0/free_bike_status.json

This file was deleted.

50 changes: 0 additions & 50 deletions gbfs-validator/versions/schemas/v1.0/gbfs.json

This file was deleted.

98 changes: 0 additions & 98 deletions gbfs-validator/versions/schemas/v1.0/station_information.json

This file was deleted.

84 changes: 0 additions & 84 deletions gbfs-validator/versions/schemas/v1.0/station_status.json

This file was deleted.

Loading
Loading