Skip to content

Commit fc74c1c

Browse files
committed
moving currency definition to common for reuse
1 parent d8fcc38 commit fc74c1c

6 files changed

Lines changed: 26 additions & 14 deletions

File tree

policy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ An individual `Policy` object is defined by the following fields:
208208
| `policy_id` | UUID | Required | Unique ID of policy |
209209
| `provider_ids` | UUID[] | Optional | Providers for whom this policy is applicable; empty arrays and `null`/absent implies all Providers. See MDS [provider list](/providers.csv). |
210210
| `description` | String | Required | Description of policy |
211-
| `currency` | String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../provider#costs--currencies) of all Rules of [type](#rule-types) `rate`.|
211+
| `currency` | String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../general-information.md#costs-and-currencies) of all Rules of [type](#rule-types) `rate`.|
212212
| `start_date` | [timestamp][ts] | Required | Beginning date/time of policy enforcement |
213213
| `end_date` | [timestamp][ts] | Optional | End date/time of policy enforcement |
214214
| `published_date` | [timestamp][ts] | Required | Timestamp that the policy was published |

schema/policy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def policy_schema():
1414
# load schema template and insert definitions
1515
schema = common.load_json("./templates/policy/policy.json")
1616
definitions = common.load_definitions(
17+
"currency",
1718
"day",
1819
"days",
1920
"iso_time",

schema/provider.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def trips_schema():
8787
# 2. There must be *at least* two Features in the FeatureCollection.
8888
features = { "items": { "$ref": common.definition_id("MDS_Feature_Point") }, "minItems": 2 }
8989
)
90-
trips_definitions = { "MDS_FeatureCollection_Route": mds_feature_collection_route }
90+
trips_definitions = {
91+
"currency": common.load_definitions("currency"),
92+
"MDS_FeatureCollection_Route": mds_feature_collection_route
93+
}
9194

9295
# create the trips schema
9396
schema = endpoint_schema("trips", trips_definitions)

schema/templates/common.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
"preferred_drop_off"
1515
]
1616
},
17+
"currency": {
18+
"$id": "#/definitions/currency",
19+
"type": [
20+
"string",
21+
"null"
22+
],
23+
"pattern": "^[A-Z]{3}$",
24+
"default": "USD",
25+
"description": "An ISO 4217 Alphabetic Currency Code representing currency of the payee. If null, USD cents is implied.",
26+
"examples": [
27+
"USD",
28+
"EUR",
29+
"GBP"
30+
]
31+
},
1732
"day": {
1833
"$id": "#/definitions/day",
1934
"type": "string",

schema/templates/policy/policy.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
"$ref": "#/definitions/string",
3434
"description": "Description of policy"
3535
},
36+
"currency": {
37+
"$id": "#/definitions/policy/properties/currency",
38+
"$ref": "#/definitions/currency"
39+
},
3640
"start_date":{
3741
"$id": "#/definitions/policy/properties/start_date",
3842
"$ref": "#/definitions/timestamp",

schema/templates/provider/trips.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,7 @@
106106
},
107107
"currency": {
108108
"$id": "#/properties/data/properties/trips/items/properties/currency",
109-
"type": [
110-
"string",
111-
"null"
112-
],
113-
"pattern": "^[A-Z]{3}$",
114-
"default": "USD",
115-
"description": "An ISO 4217 Alphabetic Currency Code representing the currency of the payee. If null, USD cents is implied.",
116-
"examples": [
117-
"USD",
118-
"EUR",
119-
"GBP"
120-
]
109+
"$ref": "#/definitions/currency"
121110
}
122111
}
123112
}

0 commit comments

Comments
 (0)