convert only.Expand description
Translating a JSON document from one OCPI version to another.
Upgrade and Downgrade work on typed objects. A hub, a client talking to a peer on an
older version and a server answering one face the problem one step earlier: they hold bytes
and know the endpoint those bytes came from, not the Rust type they will become.
ObjectKind names the objects whose wire format changed between OCPI 2.2.1 and 2.3.0, says
which one an endpoint carries, and translates a serde_json::Value — one object or a whole
page — keeping the Lossy report.
use ocpi_kit::convert::wire::{ObjectKind, Payload};
use ocpi_kit::{InterfaceRole, ModuleId};
// On a Locations Sender interface, `/{location_id}/{evse_uid}` is an EVSE.
let kind = ObjectKind::for_endpoint(
&ModuleId::Locations,
InterfaceRole::Sender,
"LOC1/3256",
Payload::Response,
);
assert_eq!(kind, Some(ObjectKind::Evse));Only the 2.2.1 ↔ 2.3.0 crossing exists. OCPI 2.1.1 is modelled and deliberately not bridged:
it has no owner fields on objects, no routing and no Price, so carrying an object across that
boundary is a decision about a deployment rather than a translation. bridgeable is the
single answer to “can this build make this crossing”.
Enums§
- Bridge
Error - Why a document could not be carried between two versions.
- Object
Kind - An OCPI object whose wire format changed between the versions this crate bridges.
- Payload
- Which half of an exchange a document is, for the two endpoints whose request and response carry different objects.
Functions§
- bridgeable
- Whether this build can translate documents between two OCPI versions.