Skip to content

Commit 9fa3fd1

Browse files
authored
Merge pull request #86 from sine-fdn/co2e_intensity_throughput
Co2e intensity throughput
2 parents 8c49f09 + ab0457a commit 9fa3fd1

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
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

+18-2
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,19 @@ pub struct Toc {
112112
pub co2e_intensity_wtw: WrappedDecimal,
113113
#[serde(rename = "co2eIntensityTTW")]
114114
pub co2e_intensity_ttw: WrappedDecimal,
115-
pub co2e_intensity_throughput: String,
115+
pub co2e_intensity_throughput: TocCo2eIntensityThroughput,
116116
#[serde(skip_serializing_if = "Option::is_none")]
117117
pub glec_data_quality_index: Option<GlecDataQualityIndex>,
118118
}
119119

120+
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, PartialEq)]
121+
#[serde(rename_all = "camelCase")]
122+
pub enum TocCo2eIntensityThroughput {
123+
#[serde(rename = "TEUkm")]
124+
TEUkm,
125+
Tkm,
126+
}
127+
120128
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, PartialEq)]
121129
#[serde(rename_all = "camelCase")]
122130
pub enum TemperatureControl {
@@ -179,7 +187,15 @@ pub struct Hoc {
179187
pub co2e_intensity_wtw: WrappedDecimal,
180188
#[serde(rename = "co2eIntensityTTW")]
181189
pub co2e_intensity_ttw: WrappedDecimal,
182-
pub co2e_intensity_throughput: String,
190+
pub co2e_intensity_throughput: HocCo2eIntensityThroughput,
191+
}
192+
193+
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, PartialEq)]
194+
#[serde(rename_all = "camelCase")]
195+
pub enum HocCo2eIntensityThroughput {
196+
#[serde(rename = "TEU")]
197+
TEU,
198+
Tonnes,
183199
}
184200

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

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)