From 00d0fe2b4506c2d0d6fdd8582d6138e5c4589fab Mon Sep 17 00:00:00 2001
From: isabelle-dr <63653518+isabelle-dr@users.noreply.github.com>
Date: Tue, 1 Mar 2022 10:50:55 -0500
Subject: [PATCH] Update RULES.md
- Update after adding the conditional requirements
- Fix typos and arranged images
---
RULES.md | 84 ++++++++++++++++++++++++++++----------------------------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/RULES.md b/RULES.md
index 7a53a62..1400203 100644
--- a/RULES.md
+++ b/RULES.md
@@ -1,41 +1,38 @@
This project validates feeds up to version 2.3-RC of the [JSON Schemas](https://github.com/MobilityData/gbfs-json-schema).
# Files presence
-The validator will display a message for all files that are present. A message will be displayed for each missing file. See examples below.
+The validator will flag any missing file. It will inform the user if the missing file is required or not, as per the conditions in the GBFS version that it detects.
-Missing file but not required:
-
-
-
-Missing file and required:
-
-
+
## Required files
-system_information.json is required for all GBFS versions.
-gbfs.json is required as of v2.0
+`system_information.json` is **required** for all GBFS versions.
+`gbfs.json` is required as of v2.0
## Conditionally required files
-Three files are conditionally required for all GBFS versions:
-station_information.json: required for systems utilizing docks
-station_status.json: required for systems utilizing docks
-free_bike_status.json: required for free floating vehicles
-The validator will check for the presence of those files depending on the options “Free-floating” or Docked” that the user selected on the interface.
+Three files are **conditionally required** for all GBFS versions:
+- `station_information.json`: required for systems utilizing docks
+- `station_status.json`: required for systems utilizing docks
+- `free_bike_status.json`: required for free floating vehicles
+The validator will check for the presence of the files depending on the options “Free-floating” or Docked” that the user selected on the interface.
+
+
-
-One additional conditionally required file has been added in GBFS version 2.1:
-vehicle_types.json
-The validator is currently considering this file as not required, because the conditions are more complex and can’t be represented by the schema currently.
+The Validator also checks the conditional requirement of the file `vehicle_types.json`: as per the [official GBFS specification](https://github.com/NABSA/gbfs/blob/master/gbfs.md#vehicle_typesjson), it is required of systems that include information about vehicle types in the `vehicle_status.json file`.
-# Fields presence and types
+
+# Fields presence and field types
## Required fields
-Each file has to be structured in a specific output format. The fields `last_updated`, `ttl`, `version`, `data` are required and checked by the validator.
-In “data”, there is a nested JSON containing all the fields mentioned in the specification. All the fields that are described as “required” will be checked by the validator.
-Some fields are required only if the parent field is defined, and this is considered a conditionally required field.
+Each file in GBFS has to be structured in a specific [output format](https://github.com/NABSA/gbfs/blob/master/gbfs.md#output-format).
+All the fields that are described as **required** in GBFS will be checked by the validator.
+Some fields are required only if the parent field is defined, and this is considered a **conditionally required** field.
## Conditionally Required fields
-This validator checks the simple "conditionally required" fields that are represented in the JSON Schemas. The following conditions are covered:
-- system_information.json
+The simple **conditionally required** fields (where the condition depends on another field in the same file) are represented by the JSON Schemas and will be checked by this validator.\
+The more complex **conditionally required fields** are covered by custom rules that have been added in this validator (in [PR#63](https://github.com/MobilityData/gbfs-validator/pull/63)).\
+
+The following conditions are all covered by this validator:
+- **system_information.json**
`brand_assets.brand_last_modified`\
`brand_assets.brand_image_url`\
@@ -46,28 +43,38 @@ This validator checks the simple "conditionally required" fields that are repres
`rental_apps.ios.store_uri`\
`rental_apps.ios.discovery_uri`
-
-- vehicle_types.json
+- **vehicle_types.json**
`vehicle_types.max_range_meters`\
`vehicle_types.vehicle_assets.icon_url`\
-`vehicle_types.vehicle_assets.icon_last_modified`
+`vehicle_types.vehicle_assets.icon_last_modified`\
+`default_pricing_plan_id`
-- station_status.json
+- **station_status.json**
`stations.vehicle_types_available.vehicle_type_id`\
`stations.vehicle_types_available.count`\
`stations.vehicle_docks_available.vehicle_type_ids`\
-`stations.vehicle_docks_available.count`
+`stations.vehicle_docks_available.count`\
+`vehicle_types_available`
-- geofencing_zones.json
+- **geofencing_zones.json**
`geofencing_zones.features.properties.rules.ride_allowed`\
`geofencing_zones.features.properties.rules.ride_through_allowed`
+- **free_bike_status.json**
+`vehicle_type_id`
+`current_range_meters`
+
+- **conditions that are not covered by this validator**
+`num_docks_available` in station_status.json`: because it depends on something that isn't defined in the GBFS files: the docking capacity. See the official GBFS spec about this field [here](https://github.com/NABSA/gbfs/blob/master/gbfs.md#station_statusjson).\
+`vehicle_docks_available` in station_status.json`: because it depends on something that isn't defined in the GBFS files: *REQUIRED in feeds where [...] certain docks are only able to accept certain vehicle types.* See the official GBFS spec about this field [here](https://github.com/NABSA/gbfs/blob/master/gbfs.md#station_statusjson).\
+`system_id` in `free_bike_status.json`
+
## Field types
Each field has a specific field type, as described in the specification.
-The validators will flag the following field type if they are invalid, as they are present in the JSON Schema:
+The validators will flag the following field type if they are invalid.
- array
- boolean
- date: defined in regex using the formula ```^[0-9]{4}-[0-9]{2}-[0-9]{2}$```
@@ -85,16 +92,9 @@ The validators will flag the following field type if they are invalid, as they a
- timestamp: Defined as integer, with minimum set to Tuesday, December 15, 2015 5:00:00 AM (when GBFS was created)
- url
-See examples for wrong field types below
-
-Wrong enum value:
-![missing enum](https://user-images.githubusercontent.com/63653518/133173526-7d031fd3-30fb-412c-be9a-4a1dc4d6ae23.png)
-
-Wrong field type:
-![wrong type](https://user-images.githubusercontent.com/63653518/133173621-0043bc10-cf21-4502-8c09-b4fc5fd3e9c6.png)
-
-
-
+See examples for wrong field types below:
+
+