#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct Erratum {
pub id: &'static str,
pub field: &'static str,
pub leading_document: &'static str,
pub openapi_document: &'static str,
pub impact: &'static str,
pub resolution: &'static str,
}
pub const ERRATA: &[Erratum] = &[
Erratum {
id: "OICP23-E001",
field: "eRoamingChargeDetailRecord.HubProviderID",
leading_document: "HubProviderID — both the CPO and EMP data-type tables, and every code snippet",
openapi_document: "HubProviderId in the EMP OpenAPI schema (whose own example still says HubProviderID); \
HubProviderID in the CPO OpenAPI schema",
impact: "A CDR routed through a hub loses its hub-provider attribution if the reader matches \
the other spelling — which is a billing attribution, not a cosmetic field.",
resolution: "Writes HubProviderID; accepts HubProviderId on input.",
},
Erratum {
id: "OICP23-E002",
field: "EvseDataRecord.ChargingStationId",
leading_document: "ChargingStationId — the CPO data-type table",
openapi_document: "ChargingStationId in the schema, but ChargingStationID in every example \
Hubject publishes, including the PushEvseData example and the CPO code snippets",
impact: "A CPO that copied the example publishes a station id no EMP reading the schema will find, \
so charge points do not group into stations on the EMP's map.",
resolution: "Writes ChargingStationId; accepts ChargingStationID on input.",
},
Erratum {
id: "OICP23-E003",
field: "ChargingFacility.Power",
leading_document: "Integer, mandatory, maximum 3 digits (0..=999 kW)",
openapi_document: "integer 0..=999 in the CPO schema; unconstrained number in the EMP schema",
impact: "A CPO publishing a 22.5 kW facility is either conformant or not depending on which \
document its partner read; a strict integer parser rejects the whole record.",
resolution: "Decodes as an exact decimal, so 22.5 arrives; Validate reports a non-integer or \
out-of-range value rather than refusing the record.",
},
Erratum {
id: "OICP23-E004",
field: "eRoamingGetChargeDetailRecords.CDRForwarded",
leading_document: "CDRForwarded — the EMP services table",
openapi_document: "CDRForwarder as the property name, while the example in the same file \
says CDRForwarded",
impact: "The filter is silently ignored by a peer expecting the other spelling, so an EMP \
reconciling CDRs gets the unfiltered set back and double-counts.",
resolution: "Writes CDRForwarded; accepts CDRForwarder on input.",
},
Erratum {
id: "OICP23-E005",
field: "eRoamingAuthorizeRemoteReservationStart/Stop.EMPPartnerSessionID",
leading_document: "EMPPartnerSessionID — consistent across every other message in both roles",
openapi_document: "EMPPartnerSessionId in the reservation schemas of both the CPO and EMP \
OpenAPI documents, while their own examples say EMPPartnerSessionID",
impact: "An EMP loses its own session correlation id on reservations only, which is precisely \
where it is needed to match a reservation to the session that follows.",
resolution: "Writes EMPPartnerSessionID; accepts EMPPartnerSessionId on input.",
},
Erratum {
id: "OICP23-E006",
field: "eRoamingChargingNotificationProgress.ChargingDuration",
leading_document: "Charging Duration = EventOccurred - ChargingStart, in milliseconds (CPO document)",
openapi_document: "\"Charging Duration = EventOccurred - Charging Duration\" in the EMP document — \
a self-referential definition that cannot be implemented",
impact: "None on the wire — the field is an integer either way — but an EMP implementing the \
EMP document literally has no definition to implement.",
resolution: "Documents and checks the CPO document's definition: EventOccurred - ChargingStart.",
},
];
impl Erratum {
#[must_use]
pub fn get(id: &str) -> Option<&'static Self> {
ERRATA.iter().find(|e| e.id == id)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn errata_ids_are_unique_and_well_formed() {
let mut seen = std::collections::HashSet::new();
for item in ERRATA {
assert!(seen.insert(item.id), "duplicate erratum id {}", item.id);
assert!(item.id.starts_with("OICP23-E"), "{} is not a well-formed id", item.id);
assert!(!item.resolution.is_empty());
}
}
#[test]
fn lookup_by_id_works() {
assert_eq!(Erratum::get("OICP23-E001").unwrap().field, "eRoamingChargeDetailRecord.HubProviderID");
assert!(Erratum::get("OICP23-E999").is_none());
}
}