Skip to content

Commit b1e8c0d

Browse files
authored
Merge pull request #710 from compilerla/schemas/pluralize-policies
1.2.0 schemas: pluralize policies
2 parents ad8e96f + 074eebc commit b1e8c0d

5 files changed

Lines changed: 168 additions & 88 deletions

File tree

Lines changed: 87 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,89 @@
11
{
2-
"name": "Tiered Dwell Time Example",
3-
"description": "First hour $2, second hour $4, every hour onwards $10",
4-
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
5-
"start_date": 1558389669540,
6-
"publish_date": 1558389669540,
7-
"end_date": null,
8-
"prev_policies": null,
9-
"provider_ids": [],
10-
"currency": "USD",
11-
"rules": [
12-
{
13-
"name": "0-1 Hour",
14-
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
15-
"rule_type": "time",
16-
"rule_units": "hours",
17-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
18-
"statuses": { "available": [], "non_operational": [] },
19-
"vehicle_types": ["bicycle", "scooter"],
20-
"maximum": 1,
21-
"inclusive_maximum": false,
22-
"rate_applies_when": "in_bounds",
23-
"rate_amount": 200,
24-
"rate_recurrence": "each_time_unit"
25-
},
26-
{
27-
"name": "1-2 Hours",
28-
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
29-
"rule_type": "time",
30-
"rule_units": "hours",
31-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
32-
"statuses": { "available": [], "non_operational": [] },
33-
"vehicle_types": ["bicycle", "scooter"],
34-
"minimum": 1,
35-
"maximum": 2,
36-
"inclusive_minimum": true,
37-
"inclusive_maximum": false,
38-
"rate_applies_when": "in_bounds",
39-
"rate_amount": 400,
40-
"rate_recurrence": "each_time_unit"
41-
},
42-
{
43-
"name": "> 2 hours",
44-
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
45-
"rule_type": "time",
46-
"rule_units": "hours",
47-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
48-
"statuses": { "available": [], "non_operational": [] },
49-
"vehicle_types": ["bicycle", "scooter"],
50-
"minimum": 2,
51-
"inclusive_minimum": true,
52-
"rate_applies_when": "in_bounds",
53-
"rate_amount": 1000,
54-
"rate_recurrence": "each_time_unit"
55-
}
56-
]
2+
"updated": 0,
3+
"version": "1.2.0",
4+
"data": {
5+
"policies": [
6+
{
7+
"name": "Tiered Dwell Time Example",
8+
"description": "First hour $2, second hour $4, every hour onwards $10",
9+
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
10+
"start_date": 1558389669540,
11+
"publish_date": 1558389669540,
12+
"end_date": null,
13+
"prev_policies": null,
14+
"provider_ids": [],
15+
"currency": "USD",
16+
"rules": [
17+
{
18+
"name": "0-1 Hour",
19+
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
20+
"rule_type": "time",
21+
"rule_units": "hours",
22+
"geographies": [
23+
"0c77c813-bece-4e8a-84fd-f99af777d198"
24+
],
25+
"statuses": {
26+
"available": [],
27+
"non_operational": []
28+
},
29+
"vehicle_types": [
30+
"bicycle",
31+
"scooter"
32+
],
33+
"maximum": 1,
34+
"inclusive_maximum": false,
35+
"rate_applies_when": "in_bounds",
36+
"rate_amount": 200,
37+
"rate_recurrence": "each_time_unit"
38+
},
39+
{
40+
"name": "1-2 Hours",
41+
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
42+
"rule_type": "time",
43+
"rule_units": "hours",
44+
"geographies": [
45+
"0c77c813-bece-4e8a-84fd-f99af777d198"
46+
],
47+
"statuses": {
48+
"available": [],
49+
"non_operational": []
50+
},
51+
"vehicle_types": [
52+
"bicycle",
53+
"scooter"
54+
],
55+
"minimum": 1,
56+
"maximum": 2,
57+
"inclusive_minimum": true,
58+
"inclusive_maximum": false,
59+
"rate_applies_when": "in_bounds",
60+
"rate_amount": 400,
61+
"rate_recurrence": "each_time_unit"
62+
},
63+
{
64+
"name": "> 2 hours",
65+
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
66+
"rule_type": "time",
67+
"rule_units": "hours",
68+
"geographies": [
69+
"0c77c813-bece-4e8a-84fd-f99af777d198"
70+
],
71+
"statuses": {
72+
"available": [],
73+
"non_operational": []
74+
},
75+
"vehicle_types": [
76+
"bicycle",
77+
"scooter"
78+
],
79+
"minimum": 2,
80+
"inclusive_minimum": true,
81+
"rate_applies_when": "in_bounds",
82+
"rate_amount": 1000,
83+
"rate_recurrence": "each_time_unit"
84+
}
85+
]
86+
}
87+
]
88+
}
5789
}

policy/examples/tiered-parking-fees-per-hour.json

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,60 @@
1919
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
2020
"rule_type": "time",
2121
"rule_units": "hours",
22-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
23-
"statuses": { "available": [], "non_operational": [] },
24-
"vehicle_types": ["bicycle", "scooter"],
22+
"geographies": [
23+
"0c77c813-bece-4e8a-84fd-f99af777d198"
24+
],
25+
"statuses": {
26+
"available": [],
27+
"non_operational": []
28+
},
29+
"vehicle_types": [
30+
"bicycle",
31+
"scooter"
32+
],
2533
"maximum": 2,
2634
"rate_amount": 1000,
27-
"rate_recurrence": "each_time_unit"
35+
"rate_recurrence": "each_time_unit"
2836
},
2937
{
3038
"name": "1-2 Hours",
3139
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
3240
"rule_type": "time",
3341
"rule_units": "hours",
34-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
35-
"statuses": { "available": [], "non_operational": [] },
36-
"vehicle_types": ["bicycle", "scooter"],
42+
"geographies": [
43+
"0c77c813-bece-4e8a-84fd-f99af777d198"
44+
],
45+
"statuses": {
46+
"available": [],
47+
"non_operational": []
48+
},
49+
"vehicle_types": [
50+
"bicycle",
51+
"scooter"
52+
],
3753
"maximum": 1,
3854
"rate_amount": 400,
39-
"rate_recurrence": "each_time_unit"
55+
"rate_recurrence": "each_time_unit"
4056
},
4157
{
4258
"name": "0-1 Hour",
4359
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
4460
"rule_type": "time",
4561
"rule_units": "hours",
46-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
47-
"statuses": { "available": [], "non_operational": [] },
48-
"vehicle_types": ["bicycle", "scooter"],
62+
"geographies": [
63+
"0c77c813-bece-4e8a-84fd-f99af777d198"
64+
],
65+
"statuses": {
66+
"available": [],
67+
"non_operational": []
68+
},
69+
"vehicle_types": [
70+
"bicycle",
71+
"scooter"
72+
],
4973
"maximum": 0,
5074
"rate_amount": 200,
51-
"rate_recurrence": "each_time_unit"
75+
"rate_recurrence": "each_time_unit"
5276
}
5377
]
5478
}

policy/examples/tiered-parking-fees-total.json

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,60 @@
1919
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
2020
"rule_type": "time",
2121
"rule_units": "hours",
22-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
23-
"statuses": { "available": [], "non_operational": [] },
24-
"vehicle_types": ["bicycle", "scooter"],
22+
"geographies": [
23+
"0c77c813-bece-4e8a-84fd-f99af777d198"
24+
],
25+
"statuses": {
26+
"available": [],
27+
"non_operational": []
28+
},
29+
"vehicle_types": [
30+
"bicycle",
31+
"scooter"
32+
],
2533
"maximum": 2,
2634
"rate_amount": 1000,
27-
"rate_recurrence": "once_on_unmatch"
35+
"rate_recurrence": "once_on_unmatch"
2836
},
2937
{
3038
"name": "1-2 Hours",
3139
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
3240
"rule_type": "time",
3341
"rule_units": "hours",
34-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
35-
"statuses": { "available": [], "non_operational": [] },
36-
"vehicle_types": ["bicycle", "scooter"],
42+
"geographies": [
43+
"0c77c813-bece-4e8a-84fd-f99af777d198"
44+
],
45+
"statuses": {
46+
"available": [],
47+
"non_operational": []
48+
},
49+
"vehicle_types": [
50+
"bicycle",
51+
"scooter"
52+
],
3753
"maximum": 1,
3854
"rate_amount": 400,
39-
"rate_recurrence": "once_on_unmatch"
55+
"rate_recurrence": "once_on_unmatch"
4056
},
4157
{
4258
"name": "0-1 Hour",
4359
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
4460
"rule_type": "time",
4561
"rule_units": "hours",
46-
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
47-
"statuses": { "available": [], "non_operational": [] },
48-
"vehicle_types": ["bicycle", "scooter"],
62+
"geographies": [
63+
"0c77c813-bece-4e8a-84fd-f99af777d198"
64+
],
65+
"statuses": {
66+
"available": [],
67+
"non_operational": []
68+
},
69+
"vehicle_types": [
70+
"bicycle",
71+
"scooter"
72+
],
4973
"maximum": 0,
5074
"rate_amount": 200,
51-
"rate_recurrence": "once_on_unmatch"
75+
"rate_recurrence": "once_on_unmatch"
5276
}
5377
]
5478
}

policy/policy.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,15 +614,15 @@
614614
"type": "object",
615615
"description": "The data records in this payload",
616616
"required": [
617-
"policy"
617+
"policies"
618618
],
619619
"properties": {
620-
"policy": {
621-
"$id": "#/properties/data/properties/policy",
620+
"policies": {
621+
"$id": "#/properties/data/properties/policies",
622622
"type": "array",
623-
"title": "The policy payload",
623+
"title": "The array of policy objects in this payload",
624624
"items": {
625-
"$id": "#/properties/data/properties/policy/items",
625+
"$id": "#/properties/data/properties/policies/items",
626626
"$ref": "#/definitions/policy"
627627
}
628628
}

schema/templates/policy/policy.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,15 @@
336336
"type": "object",
337337
"description": "The data records in this payload",
338338
"required": [
339-
"policy"
339+
"policies"
340340
],
341341
"properties": {
342342
"policies": {
343-
"$id": "#/properties/data/properties/policy",
343+
"$id": "#/properties/data/properties/policies",
344344
"type": "array",
345-
"title": "The policy payload",
345+
"title": "The array of policy objects in this payload",
346346
"items": {
347-
"$id": "#/properties/data/properties/policy/items",
347+
"$id": "#/properties/data/properties/policies/items",
348348
"$ref": "#/definitions/policy"
349349
}
350350
}

0 commit comments

Comments
 (0)