Skip to content

Commit 4610d04

Browse files
authored
feat: add openapi specification (to discuss !136) (#138)
* feat: add openapi draft (for v2.3) * feat: finish openapi (for v2.3) and update documentation * feat: simplify openapi.yaml with json-schema references; update readme
1 parent 9c6e202 commit 4610d04

File tree

4 files changed

+251
-7
lines changed

4 files changed

+251
-7
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ fabric.properties
7979
build/
8080

8181
# Inputs and outputs
82-
/input/
83-
/output/
82+
input/
83+
output/
8484

8585
# Mac
8686
*/.DS_Store

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# gbfs-json-schema
2-
JSON Schema for [General Bikeshare Feed Specification(GBFS)](https://github.com/MobilityData/gbfs/blob/master/gbfs.md) feeds, managed by MobilityData. The [gbfs-validator](https://github.com/MobilityData/gbfs-validator) links directly to them.
2+
JSON Schema for [General Bikeshare Feed Specification (GBFS)](https://github.com/MobilityData/gbfs/blob/master/gbfs.md) feeds, managed by MobilityData. The [gbfs-validator](https://github.com/MobilityData/gbfs-validator) links directly to them.
33

44
## Language Bindings
55

6-
* [TypeScript ](models/typescript/README.md)
7-
* [Java ](models/java/README.md)
8-
* [Golang ](models/golang/README.md)
9-
* [Rust ](models/rust/README.md)
6+
* [Golang](models/golang/README.md)
7+
* [Java](models/java/README.md)
8+
* [OpenAPI](models/openapi/README.md)
9+
* [TypeScript](models/typescript/README.md)
10+
* [Rust](models/rust/README.md)
1011

1112
Are we missing your favorite language? Consider contributing:
1213

models/openapi/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# GBFS OpenAPI Specification
2+
3+
OpenAPI specifications for the General Bikeshare Feed Specification (GBFS) to easily create models and client code for existing GBFS systems or server code for your own implementation.
4+
5+
## Usage
6+
7+
### Code generation
8+
9+
Many tools will let you generate models or client and server code direcly from the openapi file, e.g.
10+
11+
* [OpenAPI Generator](https://openapi-generator.tech)
12+
* [Swagger Codegen](https://swagger.io/tools/swagger-codegen/)
13+
14+
or one of [https://tools.openapis.org/categories/code-generators.html](these generators).
15+
16+
### Customization
17+
18+
The `openapi.yaml` can be extended with individual details within the `ìnfo` block. It's also recommended to add a `servers` block with your base root url, e.g.
19+
20+
```
21+
servers:
22+
- url: https://my.gbfs.org/v1
23+
```
24+
If needed, this can be overriden for a specific path.
25+
26+
## Versions
27+
- v2.3

models/openapi/v2.3/openapi.yaml

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
openapi: 3.0.3
3+
info:
4+
title: 'GBFS'
5+
version: '2.3'
6+
description: |-
7+
OpenAPI specification for [General Bikeshare Feed Specification (GBFS)](https://github.com/MobilityData/gbfs/blob/master/gbfs.md) feeds, managed by MobilityData.
8+
tags:
9+
- name: gbfs
10+
externalDocs:
11+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#gbfsjson
12+
- name: gbfs_versions
13+
externalDocs:
14+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#gbfs_versionsjson
15+
- name: system_information
16+
externalDocs:
17+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_informationjson
18+
- name: vehicle_types
19+
externalDocs:
20+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#vehicle_typesjson
21+
- name: station_information
22+
externalDocs:
23+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#station_informationjson
24+
- name: station_status
25+
externalDocs:
26+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#station_statusjson
27+
- name: free_bike_status
28+
externalDocs:
29+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#free_bike_statusjson
30+
- name: system_hours
31+
externalDocs:
32+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_hoursjson
33+
- name: system_calendar
34+
externalDocs:
35+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_calendarjson
36+
- name: system_regions
37+
externalDocs:
38+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_regionsjson
39+
- name: system_pricing_plans
40+
externalDocs:
41+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_pricing_plansjson
42+
- name: system_alerts
43+
externalDocs:
44+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_alertsjson
45+
- name: geofencing_zones
46+
externalDocs:
47+
url: https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#geofencing_zonesjson
48+
paths:
49+
/gbfs:
50+
get:
51+
tags:
52+
- gbfs
53+
operationId: getGbfs
54+
responses:
55+
'200':
56+
description: returns gbfs.json
57+
content:
58+
application/json:
59+
schema:
60+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/gbfs.json
61+
62+
/gbfs_versions:
63+
get:
64+
tags:
65+
- gbfs_versions
66+
operationId: getGbfsVersions
67+
responses:
68+
'200':
69+
description: returns gbfs_versions.json
70+
content:
71+
application/json:
72+
schema:
73+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/gbfs_versions.json
74+
75+
/system_information:
76+
get:
77+
tags:
78+
- system_information
79+
operationId: getSystemInformation
80+
responses:
81+
'200':
82+
description: returns system_information.json
83+
content:
84+
application/json:
85+
schema:
86+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/system_information.json
87+
88+
/vehicle_types:
89+
get:
90+
tags:
91+
- vehicle_types
92+
operationId: getVehicleTypes
93+
responses:
94+
'200':
95+
description: returns vehicle_types.json
96+
content:
97+
application/json:
98+
schema:
99+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/vehicle_types.json
100+
101+
/station_information:
102+
get:
103+
tags:
104+
- station_information
105+
operationId: getStationInformation
106+
responses:
107+
'200':
108+
description: returns station_information.json
109+
content:
110+
application/json:
111+
schema:
112+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/station_information.json
113+
114+
/station_status:
115+
get:
116+
tags:
117+
- station_status
118+
operationId: getStationStatus
119+
responses:
120+
'200':
121+
description: returns station_status.json
122+
content:
123+
application/json:
124+
schema:
125+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/station_status.json
126+
127+
/free_bike_status:
128+
get:
129+
tags:
130+
- free_bike_status
131+
operationId: getFreeBikeStatus
132+
responses:
133+
'200':
134+
description: returns free_bike_status.json
135+
content:
136+
application/json:
137+
schema:
138+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/free_bike_status.json
139+
140+
/system_hours:
141+
get:
142+
tags:
143+
- system_hours
144+
operationId: getSystemHours
145+
responses:
146+
'200':
147+
description: returns system_hours.json
148+
content:
149+
application/json:
150+
schema:
151+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/system_hours.json
152+
153+
/system_calendar:
154+
get:
155+
tags:
156+
- system_calendar
157+
operationId: getSystemCalendar
158+
responses:
159+
'200':
160+
description: returns system_calendar.json
161+
content:
162+
application/json:
163+
schema:
164+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/system_calendar.json
165+
166+
/system_regions:
167+
get:
168+
tags:
169+
- system_regions
170+
operationId: getSystemRegions
171+
responses:
172+
'200':
173+
description: returns system_regions.json
174+
content:
175+
application/json:
176+
schema:
177+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/system_regions.json
178+
179+
/system_pricing_plans:
180+
get:
181+
tags:
182+
- system_pricing_plans
183+
operationId: getSystemPricingPlans
184+
responses:
185+
'200':
186+
description: returns system_pricing_plans.json
187+
content:
188+
application/json:
189+
schema:
190+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/system_pricing_plans.json
191+
192+
/system_alerts:
193+
get:
194+
tags:
195+
- system_alerts
196+
operationId: getSystemAlerts
197+
responses:
198+
'200':
199+
description: returns system_alerts.json
200+
content:
201+
application/json:
202+
schema:
203+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/system_alerts.json
204+
205+
/geofencing_zones:
206+
get:
207+
tags:
208+
- geofencing_zones
209+
operationId: getGeofencingZones
210+
responses:
211+
'200':
212+
description: returns geofencing_zones.json
213+
content:
214+
application/json:
215+
schema:
216+
$ref: https://raw.githubusercontent.com/MobilityData/gbfs-json-schema/refs/heads/master/v2.3/geofencing_zones.json

0 commit comments

Comments
 (0)