Skip to main content

Module patch

Module patch 

Source
Available on crate feature transport only.
Expand description

PATCH: JSON Merge Patch with the two rules OCPI adds on top.

A PATCH request must only specify the object’s identifier (if needed to identify this object) and the fields to be updated. Any fields (both required or optional) that are left out remain unchanged.

That is RFC 7396 JSON Merge Patch, plus:

  1. last_updated is required in every PATCH — a patch without it is StatusCode::INVALID_PARAMETERS, the spec’s own example of what 2001 means.
  2. The result must still be a valid object, so a patch that nulls a required field is refused rather than applied.

Spec: 2.3.0 §transport_and_format_patch, §status_codes_2xxx_client_errors

Structs§

Patch
A partial update to an OCPI object.

Enums§

PatchFallback
What a client should do after a PATCH that the peer refused.

Functions§

merge
Applies an RFC 7396 JSON Merge Patch in place.
patch_fallback
Decides the fallback for a failed PATCH from the error the peer returned.