Skip to content

Commit ab0457a

Browse files
feat: replace strings with enums for co2eIntensityThroughput
1 parent e9ab88a commit ab0457a

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

gen/schemas/hoc.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"$ref": "#/definitions/Decimal"
1818
},
1919
"co2eIntensityThroughput": {
20-
"type": "string"
20+
"$ref": "#/definitions/HocCo2eIntensityThroughput"
2121
},
2222
"co2eIntensityWTW": {
2323
"$ref": "#/definitions/Decimal"
@@ -243,6 +243,13 @@
243243
}
244244
]
245245
},
246+
"HocCo2eIntensityThroughput": {
247+
"type": "string",
248+
"enum": [
249+
"TEU",
250+
"tonnes"
251+
]
252+
},
246253
"HubType": {
247254
"type": "string",
248255
"enum": [

gen/schemas/toc.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"$ref": "#/definitions/Decimal"
2828
},
2929
"co2eIntensityThroughput": {
30-
"type": "string"
30+
"$ref": "#/definitions/TocCo2eIntensityThroughput"
3131
},
3232
"co2eIntensityWTW": {
3333
"$ref": "#/definitions/Decimal"
@@ -245,6 +245,13 @@
245245
"mixed"
246246
]
247247
},
248+
"TocCo2eIntensityThroughput": {
249+
"type": "string",
250+
"enum": [
251+
"TEUkm",
252+
"tkm"
253+
]
254+
},
248255
"TransportMode": {
249256
"type": "string",
250257
"enum": [

gen/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub struct Hoc {
185185
pub co2e_intensity_wtw: WrappedDecimal,
186186
#[serde(rename = "co2eIntensityTTW")]
187187
pub co2e_intensity_ttw: WrappedDecimal,
188-
pub co2e_intensity_throughput: String,
188+
pub co2e_intensity_throughput: HocCo2eIntensityThroughput,
189189
}
190190

191191
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, PartialEq)]

gen/tests/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn test_toc_deser() {
6767
.into(),
6868
co2e_intensity_wtw: dec!(3.6801).into(),
6969
co2e_intensity_ttw: dec!(3.2801).into(),
70-
co2e_intensity_throughput: "tkm".to_string(),
70+
co2e_intensity_throughput: TocCo2eIntensityThroughput::Tkm,
7171
glec_data_quality_index: None,
7272
description: None,
7373
load_factor: None,

0 commit comments

Comments
 (0)