From cbc7c8537e9d78ac1fa0ddb4f827e92142d5f429 Mon Sep 17 00:00:00 2001 From: Josee Sabourin <66266820+josee-sabourin@users.noreply.github.com> Date: Thu, 22 Oct 2020 10:42:40 -0400 Subject: [PATCH] Modify schemas for v1.1 (#32) Adds versions + changes to system_information --- free_bike_status.json | 54 +++++++++++++++++++++------ gbfs.json | 12 ++++++ gbfs_versions.json | 78 +++++++++++++++++++++++++++++++++++++++ station_information.json | 56 ++++++++++++++++++++++------ station_status.json | 11 +++++- system_alerts.json | 14 +++++++ system_calendar.json | 14 +++++++ system_hours.json | 16 +++++++- system_information.json | 67 +++++++++++++++++++++++++++++++++ system_pricing_plans.json | 9 +++++ system_regions.json | 14 +++++++ 11 files changed, 319 insertions(+), 26 deletions(-) create mode 100644 gbfs_versions.json diff --git a/free_bike_status.json b/free_bike_status.json index 7e9a854c..34bfcb88 100644 --- a/free_bike_status.json +++ b/free_bike_status.json @@ -14,6 +14,14 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains one object per bike as defined below.", "type": "object", @@ -49,24 +57,46 @@ "minimum": 0, "maximum": 1 }, - "required": [ - "bike_id", - "lat", - "lon", - "is_reserved", - "is_disabled" - ] + "rental_uris": { + "description": "Contains rental uris for Android, iOS, and web in the android, ios, and web fields (added in v1.1).", + "type": "object", + "properties": { + "android": { + "description": "URI that can be passed to an Android app with an intent (added in v1.1).", + "type": "string", + "format": "uri" + }, + "ios": { + "description": "URI that can be used on iOS to launch the rental app for this vehicle (added in v1.1).", + "type": "string", + "format": "uri" + }, + "web": { + "description": "URL that can be used by a web browser to show more information about renting this vehicle (added in v1.1).", + "type": "string", + "format": "uri" + } + } + } }, "required": [ - "bikes" + "bike_id", + "lat", + "lon", + "is_reserved", + "is_disabled" ] } }, "required": [ - "last_updated", - "ttl", - "data" + "bikes" ] } - } + }, + "required": [ + "last_updated", + "ttl", + "version", + "data" + ] } diff --git a/gbfs.json b/gbfs.json index d7248c9d..a1065bed 100644 --- a/gbfs.json +++ b/gbfs.json @@ -14,6 +14,16 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Response data in the form of name:value pairs.", "type": "object", @@ -32,6 +42,7 @@ "type": "string", "enum": [ "gbfs", + "gbfs_versions", "system_information", "station_information", "station_status", @@ -66,6 +77,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] } diff --git a/gbfs_versions.json b/gbfs_versions.json new file mode 100644 index 00000000..f3ad7209 --- /dev/null +++ b/gbfs_versions.json @@ -0,0 +1,78 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://github.com/NABSA/gbfs/blob/master/gbfs.md#gbfs_versionsjson-added-in-v11", + "description": "Lists all feed endpoints published according to version sof the GBFS documentation. (added in v1.1)", + "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": [ + "1.1-RC", + "1.1", + "2.0-RC", + "2.0", + "2.1-RC", + "2.1", + "3.0-RC", + "3.0" + ] + }, + "data": { + "description": "Response data in the form of name:value pairs.", + "type": "object", + "properties": { + "versions": { + "description": "Contains one object, as defined below, for each of the available versions of a feed. The array must be sorted by increasing MAJOR and MINOR version number.", + "type": "array", + "items": { + "type": "object", + "properties": { + "version": { + "description": "The semantic version of the feed in the form X.Y", + "type": "string", + "enum": [ + "1.1-RC", + "1.1", + "2.0-RC", + "2.0", + "2.1-RC", + "2.1-RC2", + "3.0-RC", + "3.0" + ] + }, + "url": { + "description": "URL of the corresponding gbfs.json endpoint", + "type": "string", + "format": "uri" + } + }, + "required": [ + "version", + "url" + ] + } + }, + "required": true + }, + "additionalProperties": false + } + }, + "required": [ + "last_updated", + "ttl", + "version", + "data" + ] +} diff --git a/station_information.json b/station_information.json index 29525175..9ec95b20 100644 --- a/station_information.json +++ b/station_information.json @@ -14,6 +14,16 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains one object per station as defined below.", "type": "object", @@ -80,27 +90,49 @@ "minItems": 1 }, "capacity": { - "description": "Number of total docking points installed at this tation, both available and unavailable.", + "description": "Number of total docking points installed at this station, both available and unavailable.", "type": "number", "minimum": 0 }, - "required": [ - "station_id", - "name", - "lat", - "lon" - ] + "rental_uris": { + "description": "Contains rental uris for Android, iOS, and web in the android, ios, and web fields (added in v1.1).", + "type": "object", + "properties": { + "android": { + "description": "URI that can be passed to an Android app with an intent (added in v1.1).", + "type": "string", + "format": "uri" + }, + "ios": { + "description": "URI that can be used on iOS to launch the rental app for this station (added in v1.1).", + "type": "string", + "format": "uri" + }, + "web": { + "description": "URL that can be used by a web browser to show more information about renting a vehicle at this station (added in v1.1).", + "type": "string", + "format": "uri" + } + } + } }, "required": [ - "stations" + "station_id", + "name", + "lat", + "lon" ] } }, "required": [ - "last_updated", - "ttl", - "data" + "stations" ] } - } + }, + "required": [ + "last_updated", + "ttl", + "version", + "data" + ] } diff --git a/station_status.json b/station_status.json index f722b69f..1fc16434 100644 --- a/station_status.json +++ b/station_status.json @@ -14,6 +14,14 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains one object per station as defined below.", "type": "object", @@ -22,7 +30,7 @@ "type": "array", "items": { "station_id": { - "description": "identifier of a station.", + "description": "Identifier of a station.", "type": "string" }, "num_bikes_available": { @@ -88,6 +96,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] } diff --git a/system_alerts.json b/system_alerts.json index 56fc3e4d..ebaada04 100644 --- a/system_alerts.json +++ b/system_alerts.json @@ -14,6 +14,19 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains ad-hoc alerts for the system.", "type": "object", @@ -109,6 +122,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] } diff --git a/system_calendar.json b/system_calendar.json index 33459e59..7ad72eca 100644 --- a/system_calendar.json +++ b/system_calendar.json @@ -14,6 +14,19 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains opertions calendar for the system.", "type": "object", @@ -72,6 +85,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] } diff --git a/system_hours.json b/system_hours.json index 6f603d04..7d570d3b 100644 --- a/system_hours.json +++ b/system_hours.json @@ -14,6 +14,19 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains system hours of operations.", "type": "object", @@ -79,6 +92,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] -} +} \ No newline at end of file diff --git a/system_information.json b/system_information.json index 12e6be98..4b494646 100644 --- a/system_information.json +++ b/system_information.json @@ -14,6 +14,17 @@ "type": "integer", "minimum": 0 }, + "version": { + "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", + "2.1-RC", + "2.1-RC2" + ] + }, "data": { "description": "Response data in the form of name:value pairs.", "type": "object", @@ -63,6 +74,11 @@ "type": "string", "format": "email" }, + "feed_contact_email": { + "description": "A single contact email address for consumers of this feed to report technical issues (added in v1.1).", + "type": "string", + "format": "email" + }, "timezone": { "description": "The time zone where the system is located.", "type": "string" @@ -71,6 +87,56 @@ "description": "A fully qualified URL of a page that defines the license terms for the GBFS data for this system.", "type": "string", "format": "uri" + }, + "rental_apps": { + "description": "Contains rental app information in the android and ios JSON objects (added in v1.1).", + "type": "object", + "properties": { + "android": { + "description": "Contains rental app download and app discovery information for the Android platform. (added in v1.1)", + "type": "object", + "properties": { + "store_uri": { + "description": "URI where the rental Android app can be downloaded from (added in v1.1).", + "type": "string", + "format": "URI" + }, + "discovery_uri": { + "description": "URI that can be used to discover if the rental Android app is installed on the device (added in v1.1).", + "type": "string", + "format": "URI" + } + }, + "dependencies": { + "android": [ + "store_uri", + "discovery_uri" + ] + } + }, + "ios": { + "description": "Contains rental information for the iOS platform (added in v1.1).", + "type": "object", + "properties": { + "store_uri": { + "description": "URI where the rental iOS app can be downloaded from (added in v1.1).", + "type": "string", + "format": "URI" + }, + "discovery_uri": { + "description": "URI that can be used to discover if the rental iOS app is installed on the device (added in v1.1).", + "type": "string", + "format": "URI" + } + }, + "dependencies": { + "ios": [ + "store_uri", + "discovery_uri" + ] + } + } + } } }, "required": [ @@ -84,6 +150,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] } diff --git a/system_pricing_plans.json b/system_pricing_plans.json index 1ba33481..672af454 100644 --- a/system_pricing_plans.json +++ b/system_pricing_plans.json @@ -14,6 +14,14 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "description": "Array that contains one object per plan as defined below.", "type": "object", @@ -73,6 +81,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] } diff --git a/system_regions.json b/system_regions.json index b09db51a..8afeafff 100644 --- a/system_regions.json +++ b/system_regions.json @@ -14,6 +14,19 @@ "type": "integer", "minimum": 0 }, + "version": { + "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" + ] + }, "data": { "type": "object", "properties": { @@ -44,6 +57,7 @@ "required": [ "last_updated", "ttl", + "version", "data" ] }