Skip to content

Commit

Permalink
Add schemas for v2.1-RC (#34)
Browse files Browse the repository at this point in the history
Add vehicle type definitions
Add geofencing, virtual station, and dockless support
  • Loading branch information
josee-sabourin authored Oct 27, 2020
1 parent f882cf4 commit 23d0663
Show file tree
Hide file tree
Showing 6 changed files with 409 additions and 26 deletions.
44 changes: 29 additions & 15 deletions free_bike_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"description": "GBFS version number to which the feed conforms, according to the versioning framework (added in v1.1).",
"type": "string",
"enum": [
"2.0"
"2.1-RC"
]
},
"data": {
Expand Down Expand Up @@ -72,26 +72,40 @@
"format": "uri"
}
}
}
},
"vehicle_type_id": {
"description": "The vehicle_type_id of this vehicle (added in v2.1-RC).",
"type": "string"
},
"last_reported": {
"description": "The last time this vehicle reported its status to the operator's backend in POSIX time (added in v2.1-RC).",
"type": "number",
"minimum": 1450155600
},
"current_range_meters": {
"description": "The furthest distance in meters that the vehicle can travel without recharging or refueling with the vehicle's current charge or fuel (added in v2.1-RC).",
"type": "number",
"minimum": 0
},
"required": [
"bike_id",
"lat",
"lon",
"is_reserved",
"is_disabled"
]
},
"required": [
"bike_id",
"lat",
"lon",
"is_reserved",
"is_disabled"
"bikes"
]
}
},
"required": [
"bikes"
"last_updated",
"ttl",
"version",
"data"
]
}
},
"required": [
"last_updated",
"ttl",
"version",
"data"
]
}
}
12 changes: 7 additions & 5 deletions gbfs.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"description": "GBFS version number to which the feed conforms, according to the versioning framework (added in v1.1).",
"type": "string",
"enum": [
"1.1-RC",
"1.1",
"2.0-RC",
"2.0"
"2.1-RC",
"2.1-RC2",
"3.0-RC",
"3.0"
]
},
"data": {
Expand All @@ -44,14 +44,16 @@
"gbfs",
"gbfs_versions",
"system_information",
"vehicle_types",
"station_information",
"station_status",
"free_bike_status",
"system_hours",
"system_alerts",
"system_calendar",
"system_regions",
"system_pricing_plans"
"system_pricing_plans",
"geofencing_zones"
]
},
"url": {
Expand Down
155 changes: 155 additions & 0 deletions geofencing_zones.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/NABSA/gbfs/blob/master/gbfs.md#geofencing_zonesjson",
"description": "Describes geofencing zones and their associated rules and attributes (added in v2.1-RC).",
"type": "object",
"properties": {
"last_updated": {
"description": "Last time the data in the feed was updated in POSIX time.",
"type": "integer",
"minimum": 1450155600
},
"ttl": {
"description": "Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).",
"type": "integer",
"minimum": 0
},
"version": {
"description": "GBFS version number to which the feed conforms, according to the versioning framework.",
"type": "string",
"enum": [
"2.1-RC",
"2.1-RC2",
"2.1",
"3.0-RC",
"3.0"
]
},
"data": {
"description": "Array that contains geofencing information for the system.",
"type": "object",
"properties": {
"geofencing_zones": {
"type": "array",
"items": {
"type": {
"description": "FeatureCollection as per IETF RFC 7946.",
"type": "string",
"enum": [
"FeatureCollection"
]
},
"features": {
"description": "Array of objects.",
"type": "array",
"items": {
"title": "GeoJSON Feature",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Feature"
]
},
"properties": {
"description": "Describing travel allowances and limitations.",
"type": "object",
"properties": {
"name": {
"description": "Public name of the geofencing zone.",
"type": "string"
},
"start": {
"description": "Start time of the geofencing zone in POSIX time.",
"type": "number",
"minimum": 1450155600
},
"end": {
"description": "End time of the geofencing zone in POSIX time.",
"type": "number",
"minimum": 1450155600
},
"rules": {
"description": "Array that contains one object per rule.",
"type": "array",
"items": {
"vehicle_type_id": {
"description": "Array of vehicle type IDs for which these restrictions apply.",
"type": "array"
},
"ride_allowed": {
"description": "Is the undocked ride allowed to stat and end in this zone?",
"type": "boolean"
},
"ride_through_allowed": {
"description": "Is the ride allowed to travel through this zone?",
"type": "boolean"
},
"maximum_speed_kph": {
"description": "What is the maximum speed allowed, in kilometers per hour?",
"type": "number",
"minimum": 0
}
}
}
},
"required": [
"ride_allowed",
"ride_through_allowed"
]
},
"geometry": {
"description": "A polygon that describes where rides might not be able to start, end, go through, or have otehr limitations. Must follow the right-hand rule.",
"title": "GeoJSON MultiPolygon",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"MultiPolygon"
]
},
"coordinates": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "array",
"minItems": 4,
"items": {
"type": "array",
"minItems": 2,
"items": {
"type": "number"
}
}
}
}
}
},
"required": [
"type",
"coordinates"
]
}
}
}
}
},
"required": [
"type",
"geometry",
"properties"
]
}
}
}
},
"required": [
"last_updated",
"ttl",
"version",
"data"
]
}
60 changes: 56 additions & 4 deletions station_information.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"description": "GBFS version number to which the feed conforms, according to the versioning framework (added in v1.1).",
"type": "string",
"enum": [
"1.1-RC",
"1.1",
"2.0-RC",
"2.0"
"2.1-RC"
]
},
"data": {
Expand Down Expand Up @@ -89,11 +86,59 @@
},
"minItems": 1
},
"is_virtual_station": {
"description": "Is this station a location with or without physical infrastructure? (added in v2.1-RC)",
"type": "boolean"
},
"station_area": {
"description": "A multipolygon that describes the area of a virtual station (added in v2.1-RC).",
"type": "object",
"required": [
"type",
"coordinates"
],
"properties": {
"type": {
"type": "string",
"enum": [
"Multipolygon"
]
},
"coordinates": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "array",
"minItems": 4,
"items": {
"type": "array",
"minItems": 2,
"items": {
"type": "number"
}
}
}
}
}
}
},
"capacity": {
"description": "Number of total docking points installed at this station, both available and unavailable.",
"type": "number",
"minimum": 0
},
"vehicle_capacity": {
"description": "An object where each key is a vehicle_type_id and the value is a number presenting the total number of vehicles of this type that can park within the station_area (added in v2.1-RC).",
"type": "object",
"properties": {
"type": "number"
}
},
"is_valet_station": {
"description": "Are valet services provided at this station? (added in v2.1-RC)",
"type": "boolean"
},
"rental_uris": {
"description": "Contains rental uris for Android, iOS, and web in the android, ios, and web fields (added in v1.1).",
"type": "object",
Expand All @@ -114,6 +159,13 @@
"format": "uri"
}
}
},
"vehicle_type_capacity": {
"description": "An object where each key is a vehicle_type_id and the value is a number representing the total docking points installed at this station for each vehicle type (added in v2.1-RC).",
"type": "object",
"additionalProperties": {
"type": "number"
}
}
},
"required": [
Expand Down
Loading

0 comments on commit 23d0663

Please sign in to comment.