#[non_exhaustive]pub struct Annotation {
pub id: Option<Id>,
pub related_type: Option<String>,
pub related_id: Id,
pub is_private: Option<bool>,
pub extra: Map<String, Value>,
}Expand description
General-purpose vendor metadata (draft-ietf-jmap-metadata-01 §2.1.1).
The @type wire value is "Annotation"; it is supplied by the enclosing
Metadata tag and does NOT appear as a field on this struct.
§Vendor-specific properties (§2.2.1.6)
Annotations are designed to carry arbitrary vendor-defined properties
beyond the common fields below. Vendor properties MUST be prefixed with a
domain name owned by the vendor, e.g. acme.example.com:color. Those
fields are captured in extra and round-trip
losslessly per the workspace extras-preservation policy.
§id is server-set
On Metadata/set create operations the client omits id; the server
assigns it. id is Option<Id> so client-side request construction is
natural.
§isPrivate default
Per §2.2.1.5 the default is false. The field is Option<bool> so
callers can distinguish “explicitly false on the wire” from “absent”.
Wire-omitted defaults to shared.
§relatedType is optional on the wire
Per §2.2.1.3 relatedType is mandatory on full Metadata objects, but
the extended-/get partial-response shape defined by §4.1 omits it
when the caller filtered it out via metadataProperties. §4.1 lists
only @type and relatedId as always-included; everything else
(including relatedType) is omittable. The §7.2 example response
demonstrates this shape. To round-trip the wire format faithfully
the field is Option<String>. Callers constructing a Metadata
object for Metadata/set MUST populate relatedType (otherwise
the server will reject with invalidProperties).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: Option<Id>Server-assigned identifier. Absent on create requests.
JMAP type name of the related object (e.g. "Email", "Mailbox").
Mandatory per §2.2.1.3 on full Metadata objects, but omittable in
the §4.1 extended-/get partial-response shape (the §7.2 example
demonstrates this). None indicates the wire input omitted the
field; callers consuming partial responses can infer the type
from context (e.g. the data type whose /get produced the
response). Callers constructing a Metadata object for
Metadata/set MUST populate this field.
Identifier of the related JMAP object. Mandatory per §2.2.1.4.
is_private: Option<bool>Whether this annotation is private to the authenticated user.
Default false per §2.2.1.5.
extra: Map<String, Value>Vendor-specific properties (§2.2.1.6) and any other extension fields not covered by the typed fields above.
Captures every JSON key on the wire that is not @type, id,
relatedType, relatedId, or isPrivate. Vendor properties are
domain-prefixed strings (e.g. acme.example.com:color) per the
spec’s naming requirement.
Round-trips losslessly per the workspace extras-preservation policy
(see workspace AGENTS.md). Empty-map case serialises to nothing,
preserving wire-byte identity with the spec examples.