|
1 | 1 | { |
2 | 2 | "$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/dockless/events.json", |
3 | 3 | "$schema": "http://json-schema.org/draft-06/schema#", |
4 | | - "title": "The MDS Provider Schema, events payload", |
| 4 | + "title": "Schema for MDS Provider events payloads", |
5 | 5 | "type": "object", |
6 | 6 | "definitions": { |
| 7 | + "Point": { |
| 8 | + "$id": "#/definitions/Point", |
| 9 | + "title": "GeoJSON Point", |
| 10 | + "type": "object", |
| 11 | + "required": [ |
| 12 | + "type", |
| 13 | + "coordinates" |
| 14 | + ], |
| 15 | + "properties": { |
| 16 | + "type": { |
| 17 | + "type": "string", |
| 18 | + "enum": [ |
| 19 | + "Point" |
| 20 | + ] |
| 21 | + }, |
| 22 | + "coordinates": { |
| 23 | + "type": "array", |
| 24 | + "minItems": 2, |
| 25 | + "items": [ |
| 26 | + { |
| 27 | + "type": "number", |
| 28 | + "minimum": -180.0, |
| 29 | + "maximum": 180.0 |
| 30 | + }, |
| 31 | + { |
| 32 | + "type": "number", |
| 33 | + "minimum": -90.0, |
| 34 | + "maximum": 90.0 |
| 35 | + } |
| 36 | + ], |
| 37 | + "maxItems": 2 |
| 38 | + }, |
| 39 | + "bbox": { |
| 40 | + "type": "array", |
| 41 | + "minItems": 4, |
| 42 | + "items": { |
| 43 | + "type": "number" |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + }, |
| 48 | + "MDS_Feature_Point": { |
| 49 | + "$id": "#/definitions/MDS_Feature_Point", |
| 50 | + "title": "MDS GeoJSON Feature Point", |
| 51 | + "type": "object", |
| 52 | + "required": [ |
| 53 | + "type", |
| 54 | + "properties", |
| 55 | + "geometry" |
| 56 | + ], |
| 57 | + "properties": { |
| 58 | + "type": { |
| 59 | + "type": "string", |
| 60 | + "enum": [ |
| 61 | + "Feature" |
| 62 | + ] |
| 63 | + }, |
| 64 | + "properties": { |
| 65 | + "type": "object", |
| 66 | + "required": [ |
| 67 | + "timestamp" |
| 68 | + ], |
| 69 | + "properties": { |
| 70 | + "timestamp": { |
| 71 | + "$ref": "#/definitions/timestamp" |
| 72 | + } |
| 73 | + } |
| 74 | + }, |
| 75 | + "geometry": { |
| 76 | + "$ref": "#/definitions/Point" |
| 77 | + }, |
| 78 | + "bbox": { |
| 79 | + "type": "array", |
| 80 | + "minItems": 4, |
| 81 | + "items": { |
| 82 | + "type": "number" |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | + }, |
| 87 | + "propulsion_type": { |
| 88 | + "$id": "#/definitions/propulsion_type", |
| 89 | + "type": "array", |
| 90 | + "description": "The type of propulsion; allows multiple values", |
| 91 | + "items": { |
| 92 | + "type": "string", |
| 93 | + "enum": [ |
| 94 | + "combustion", |
| 95 | + "electric", |
| 96 | + "electric_assist", |
| 97 | + "human" |
| 98 | + ] |
| 99 | + }, |
| 100 | + "minItems": 1 |
| 101 | + }, |
| 102 | + "string": { |
| 103 | + "$id": "#/definitions/string", |
| 104 | + "type": "string", |
| 105 | + "description": "A length-limited string type", |
| 106 | + "maxLength": 255, |
| 107 | + "default": "", |
| 108 | + "examples": [ |
| 109 | + "ABC123" |
| 110 | + ], |
| 111 | + "pattern": "^(.*)$" |
| 112 | + }, |
| 113 | + "timestamp": { |
| 114 | + "$id": "#/definitions/timestamp", |
| 115 | + "title": "Integer milliseconds since Unix epoch", |
| 116 | + "type": "number", |
| 117 | + "multipleOf": 1.0, |
| 118 | + "minimum": 0 |
| 119 | + }, |
| 120 | + "uuid": { |
| 121 | + "$id": "#/definitions/uuid", |
| 122 | + "type": "string", |
| 123 | + "title": "A UUID used to uniquely identifty an object", |
| 124 | + "default": "", |
| 125 | + "examples": [ |
| 126 | + "3c9604d6-b5ee-11e8-96f8-529269fb1459" |
| 127 | + ], |
| 128 | + "pattern": "^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$" |
| 129 | + }, |
| 130 | + "vehicle_type": { |
| 131 | + "$id": "#/definitions/vehicle_type", |
| 132 | + "type": "string", |
| 133 | + "description": "The type of vehicle", |
| 134 | + "enum": [ |
| 135 | + "bicycle", |
| 136 | + "car", |
| 137 | + "scooter", |
| 138 | + "moped" |
| 139 | + ] |
| 140 | + }, |
| 141 | + "version": { |
| 142 | + "$id": "#/definitions/version", |
| 143 | + "type": "string", |
| 144 | + "title": "The MDS Provider version this data represents", |
| 145 | + "examples": [ |
| 146 | + "0.4.0" |
| 147 | + ], |
| 148 | + "pattern": "^0\\.4\\.[0-9]+$" |
| 149 | + }, |
7 | 150 | "links": { |
8 | 151 | "$id": "#/definitions/links", |
9 | 152 | "type": "object", |
|
65 | 208 | } |
66 | 209 | }, |
67 | 210 | "required": [ |
68 | | - "version", |
69 | | - "data" |
| 211 | + "data", |
| 212 | + "version" |
70 | 213 | ], |
71 | 214 | "properties": { |
72 | | - "version": { |
73 | | - "$id": "#/properties/version", |
74 | | - "$ref": "#/definitions/version" |
75 | | - }, |
76 | 215 | "data": { |
77 | 216 | "$id": "#/properties/data", |
78 | 217 | "type": "object", |
79 | | - "title": "The page of data", |
| 218 | + "description": "The data records in this payload", |
80 | 219 | "required": [ |
81 | 220 | "status_changes" |
82 | 221 | ], |
|
89 | 228 | "$id": "#/properties/data/properties/status_changes/items", |
90 | 229 | "type": "object", |
91 | 230 | "title": "The status_change item schema", |
| 231 | + "additionalProperties": false, |
92 | 232 | "required": [ |
93 | 233 | "provider_name", |
94 | 234 | "provider_id", |
|
103 | 243 | ], |
104 | 244 | "properties": { |
105 | 245 | "provider_name": { |
106 | | - "$id": "#/properties/data/properties/status_changes/items/properties/provider_name", |
107 | | - "type": "string", |
108 | | - "description": "The public-facing name of the Provider", |
109 | | - "examples": [ |
110 | | - "Provider Name" |
111 | | - ], |
112 | | - "pattern": "^(.*)$" |
| 246 | + "$id": "#/definitions/vehicle/properties/provider_name", |
| 247 | + "$ref": "#/definitions/string", |
| 248 | + "description": "The public-facing name of the Provider" |
113 | 249 | }, |
114 | 250 | "provider_id": { |
115 | | - "$id": "#/properties/data/properties/status_changes/items/properties/provider_id", |
116 | | - "description": "The UUID for the Provider, unique within MDS", |
117 | | - "$ref": "#/definitions/uuid" |
| 251 | + "$id": "#/definitions/vehicle/properties/provider_id", |
| 252 | + "$ref": "#/definitions/uuid", |
| 253 | + "description": "The UUID for the Provider, unique within MDS" |
118 | 254 | }, |
119 | 255 | "device_id": { |
120 | | - "$id": "#/properties/data/properties/status_changes/items/properties/device_id", |
121 | | - "description": "A unique device ID in UUID format", |
122 | | - "$ref": "#/definitions/uuid" |
| 256 | + "$id": "#/definitions/vehicle/properties/device_id", |
| 257 | + "$ref": "#/definitions/uuid", |
| 258 | + "description": "A unique device ID in UUID format" |
123 | 259 | }, |
124 | 260 | "vehicle_id": { |
125 | | - "$id": "#/properties/data/properties/status_changes/items/properties/vehicle_id", |
126 | | - "type": "string", |
127 | | - "description": "The Vehicle Identification Number visible on the vehicle itself", |
128 | | - "default": "", |
129 | | - "examples": [ |
130 | | - "ABC123" |
131 | | - ], |
132 | | - "pattern": "^(.*)$" |
| 261 | + "$id": "#/definitions/vehicle/properties/vehicle_id", |
| 262 | + "$ref": "#/definitions/string", |
| 263 | + "description": "The Vehicle Identification Number visible on the vehicle itself" |
133 | 264 | }, |
134 | 265 | "vehicle_type": { |
135 | | - "$id": "#/properties/data/properties/status_changes/items/properties/vehicle_type", |
| 266 | + "$id": "#/definitions/vehicle/properties/vehicle_type", |
136 | 267 | "$ref": "#/definitions/vehicle_type", |
137 | 268 | "description": "The type of vehicle" |
138 | 269 | }, |
139 | 270 | "propulsion_type": { |
140 | | - "$id": "#/properties/data/properties/status_changes/items/properties/propulsion_type", |
141 | | - "description": "The type of propulsion; allows multiple values", |
142 | | - "$ref": "#/definitions/propulsion_type" |
| 271 | + "$id": "#/definitions/vehicle/properties/propulsion_type", |
| 272 | + "$ref": "#/definitions/propulsion_type", |
| 273 | + "description": "The type of propulsion; allows multiple values" |
143 | 274 | }, |
144 | 275 | "event_time": { |
145 | 276 | "$id": "#/properties/data/properties/status_changes/items/properties/event_time", |
146 | | - "description": "The time the event occurred, expressed as a Unix Timestamp", |
147 | | - "$ref": "#/definitions/timestamp" |
| 277 | + "$ref": "#/definitions/timestamp", |
| 278 | + "description": "The time the event occurred, expressed as a Unix Timestamp" |
148 | 279 | }, |
149 | 280 | "publication_time": { |
150 | 281 | "$id": "#/properties/data/properties/status_changes/items/properties/publication_time", |
151 | | - "description": "The time the event became available through the status changes endpoint, expressed as a Unix Timestamp", |
152 | | - "$ref": "#/definitions/timestamp" |
| 282 | + "$ref": "#/definitions/timestamp", |
| 283 | + "description": "The time the event became available through the status changes endpoint, expressed as a Unix Timestamp" |
153 | 284 | }, |
154 | 285 | "event_location": { |
155 | 286 | "$id": "#/properties/data/properties/status_changes/items/properties/event_location", |
156 | | - "description": "The GPS or GNSS coordinates of where the event occurred", |
157 | | - "$ref": "#/definitions/MDS_Feature_Point" |
| 287 | + "$ref": "#/definitions/MDS_Feature_Point", |
| 288 | + "description": "The GPS or GNSS coordinates of where the event occurred" |
158 | 289 | }, |
159 | 290 | "event_type": { |
| 291 | + "$id": "#/properties/data/properties/status_changes/items/properties/event_type", |
160 | 292 | "type": "string", |
161 | 293 | "description": "The type of the event" |
162 | 294 | }, |
163 | 295 | "event_type_reason": { |
| 296 | + "$id": "#/properties/data/properties/status_changes/items/properties/event_type_reason", |
164 | 297 | "type": "string", |
165 | 298 | "description": "The reason for the event" |
166 | 299 | }, |
|
179 | 312 | }, |
180 | 313 | "associated_trip": { |
181 | 314 | "$id": "#/properties/data/properties/status_changes/items/properties/associated_trip", |
182 | | - "description": "Trip UUID, required if event_type_reason is user_pick_up or user_drop_off", |
183 | | - "$ref": "#/definitions/uuid" |
| 315 | + "$ref": "#/definitions/uuid", |
| 316 | + "description": "Trip UUID, required if event_type is user_pick_up or user_drop_off" |
184 | 317 | }, |
185 | 318 | "associated_ticket": { |
186 | | - "type": "string", |
| 319 | + "$id": "#/properties/data/properties/status_changes/items/properties/associated_ticket", |
| 320 | + "$ref": "#/definitions/string", |
187 | 321 | "description": "Identifier for an associated ticket inside an Agency-maintained 311 or CRM system." |
188 | 322 | } |
189 | 323 | }, |
|
285 | 419 | }, |
286 | 420 | "additionalProperties": false |
287 | 421 | }, |
| 422 | + "version": { |
| 423 | + "$id": "#/properties/version", |
| 424 | + "$ref": "#/definitions/version" |
| 425 | + }, |
288 | 426 | "links": { |
289 | 427 | "$id": "#/properties/links", |
290 | 428 | "$ref": "#/definitions/links" |
|
0 commit comments