Skip to main content

ocpi_lenient_enum

Macro ocpi_lenient_enum 

Source
macro_rules! ocpi_lenient_enum {
    (
        $(#[$meta:meta])*
        $vis:vis enum $name:ident {
            $(
                $(#[$vmeta:meta])*
                $variant:ident = $wire:literal
            ),* $(,)?
        }
    ) => { ... };
}
Expand description

Defines an enum the specification declares closed, but which this crate still accepts unknown values for — and reports them.

OCPI 2.2.1 has no OpenEnum at all: ConnectorType, TokenType and the rest are closed, so by the letter of that specification an unrecognised connector type is a decode error. In practice new plug standards appear faster than OCPI releases — OCPI 2.3.0 reclassified exactly these enums as OpenEnum for that reason — and refusing the value would make a whole page of Locations undecodable over one connector nobody has heard of.

So the value is kept, and Validate reports it as a ViolationCode::Inconsistent violation. Decoding succeeds; a conformance report still says the peer sent something its own version does not define.