Skip to content

Commit

Permalink
use contains for vehicle_events rule
Browse files Browse the repository at this point in the history
Ensure that the vehicle_events array contains
at least one of the valid transition events
for the given vehicle_state
  • Loading branch information
thekaveman committed Jun 29, 2020
1 parent ff9d49a commit 5fbf59a
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 618 deletions.
117 changes: 14 additions & 103 deletions agency/get_vehicle.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,29 +198,10 @@
{
"properties": {
"state": {
"enum": [
"available"
]
"const": "available"
},
"prev_events": {
"items": {
"not": {
"enum": [
"agency_drop_off",
"battery_charged",
"comms_restored",
"maintenance",
"on_hours",
"provider_drop_off",
"reservation_cancel",
"system_resume",
"trip_cancel",
"trip_end",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"agency_drop_off",
"battery_charged",
Expand All @@ -241,20 +222,10 @@
{
"properties": {
"state": {
"enum": [
"elsewhere"
]
"const": "elsewhere"
},
"prev_events": {
"items": {
"not": {
"enum": [
"comms_restored",
"trip_leave_jurisdiction"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_restored",
"trip_leave_jurisdiction"
Expand All @@ -266,24 +237,10 @@
{
"properties": {
"state": {
"enum": [
"non_operational"
]
"const": "non_operational"
},
"prev_events": {
"items": {
"not": {
"enum": [
"battery_low",
"comms_restored",
"maintenance",
"off_hours",
"system_suspend",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"battery_low",
"comms_restored",
Expand All @@ -299,21 +256,10 @@
{
"properties": {
"state": {
"enum": [
"on_trip"
]
"const": "on_trip"
},
"prev_events": {
"items": {
"not": {
"enum": [
"comms_restored",
"trip_enter_jurisdiction",
"trip_start"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_restored",
"trip_enter_jurisdiction",
Expand All @@ -326,24 +272,10 @@
{
"properties": {
"state": {
"enum": [
"removed"
]
"const": "removed"
},
"prev_events": {
"items": {
"not": {
"enum": [
"agency_pick_up",
"compliance_pick_up",
"decommissioned",
"maintenance_pick_up",
"rebalance_pick_up",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"agency_pick_up",
"compliance_pick_up",
Expand All @@ -359,20 +291,10 @@
{
"properties": {
"state": {
"enum": [
"reserved"
]
"const": "reserved"
},
"prev_events": {
"items": {
"not": {
"enum": [
"comms_restored",
"reservation_start"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_restored",
"reservation_start"
Expand All @@ -384,21 +306,10 @@
{
"properties": {
"state": {
"enum": [
"unknown"
]
"const": "unknown"
},
"prev_events": {
"items": {
"not": {
"enum": [
"comms_lost",
"missing",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_lost",
"missing",
Expand Down
117 changes: 14 additions & 103 deletions agency/post_vehicle_event.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,29 +170,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"available"
]
"const": "available"
},
"event_types": {
"items": {
"not": {
"enum": [
"agency_drop_off",
"battery_charged",
"comms_restored",
"maintenance",
"on_hours",
"provider_drop_off",
"reservation_cancel",
"system_resume",
"trip_cancel",
"trip_end",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"agency_drop_off",
"battery_charged",
Expand All @@ -213,20 +194,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"elsewhere"
]
"const": "elsewhere"
},
"event_types": {
"items": {
"not": {
"enum": [
"comms_restored",
"trip_leave_jurisdiction"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_restored",
"trip_leave_jurisdiction"
Expand All @@ -238,24 +209,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"non_operational"
]
"const": "non_operational"
},
"event_types": {
"items": {
"not": {
"enum": [
"battery_low",
"comms_restored",
"maintenance",
"off_hours",
"system_suspend",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"battery_low",
"comms_restored",
Expand All @@ -271,21 +228,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"on_trip"
]
"const": "on_trip"
},
"event_types": {
"items": {
"not": {
"enum": [
"comms_restored",
"trip_enter_jurisdiction",
"trip_start"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_restored",
"trip_enter_jurisdiction",
Expand All @@ -298,24 +244,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"removed"
]
"const": "removed"
},
"event_types": {
"items": {
"not": {
"enum": [
"agency_pick_up",
"compliance_pick_up",
"decommissioned",
"maintenance_pick_up",
"rebalance_pick_up",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"agency_pick_up",
"compliance_pick_up",
Expand All @@ -331,20 +263,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"reserved"
]
"const": "reserved"
},
"event_types": {
"items": {
"not": {
"enum": [
"comms_restored",
"reservation_start"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_restored",
"reservation_start"
Expand All @@ -356,21 +278,10 @@
{
"properties": {
"vehicle_state": {
"enum": [
"unknown"
]
"const": "unknown"
},
"event_types": {
"items": {
"not": {
"enum": [
"comms_lost",
"missing",
"unspecified"
]
}
},
"additionalItems": {
"contains": {
"enum": [
"comms_lost",
"missing",
Expand Down
Loading

0 comments on commit 5fbf59a

Please sign in to comment.