Skip to content

Latest commit

 

History

History
100 lines (76 loc) · 5.02 KB

RULES.md

File metadata and controls

100 lines (76 loc) · 5.02 KB

This project validates feeds up to version 3.1-RC of the JSON Schemas.

Files presence

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.

Screen Shot 2022-03-01 at 10 10 07 AM

Required files

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 the files depending on the options “Free-floating” or Docked” that the user selected on the interface.

tick boxes

The Validator also checks the conditional requirement of the file vehicle_types.json: as per the official GBFS specification, it is required of systems that include information about vehicle types in the vehicle_status.json file.

Fields presence and field types

Required fields

Each file in GBFS has to be structured in a specific 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

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).\

The following conditions are all covered by this validator:

  • system_information.json

brand_assets.brand_last_modified
brand_assets.brand_image_url
terms_last_updated
privacy_last_updated
rental_apps.android.store_uri
rental_apps.android.discovery_uri
rental_apps.ios.store_uri
rental_apps.ios.discovery_uri

  • vehicle_types.json

vehicle_types.max_range_meters
vehicle_types.vehicle_assets.icon_url
vehicle_types.vehicle_assets.icon_last_modified
default_pricing_plan_id

  • 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
vehicle_types_available

  • 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/MobilityData/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.
    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.

  • array
  • boolean
  • date: defined in regex using the formula ^[0-9]{4}-[0-9]{2}-[0-9]{2}$
  • email
  • enum
  • float
  • language: defined in regex with the formula ^[a-z]{2,3}(-[A-Z]{2})?$
  • latitude: defined as number with a minimum of -90 and maximum of 90
  • longitude: defined as number with a minimum of -180 and maximum of 180
  • non-negative Float: defined as number
  • non-negative Integer: defined as number
  • object
  • string
  • time: defined in regex with the formula ^([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$
  • 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:

enum

type