Expand description
JMAP Object Metadata extension data types.
Implements the data types defined in draft-ietf-jmap-metadata-04. Types only — no method handlers, no async, no network I/O.
§Architecture change from -01 to -02
Since -02, the draft has no standalone Metadata object type. Instead,
each listed data type gains metadata (shared) and privateMetadata
(per-user) properties — plain String[Object] maps keyed by namespace
identifier.
This crate provides the helper types that consumers need:
- Crate root —
DataTypeMetadataInfo,JMAP_METADATA_URI(§1.2.1) filter—MetadataTextMatch,WithMetadata(§3.6)namespace— namespace identifier validation (§2.1)
All public types and functions are re-exported at the crate root.
§Example
use jmap_metadata_types::{DataTypeMetadataInfo, is_valid_namespace};
// Server advertises per-type metadata capability
let json = r#"{
"namespaces": ["photography"],
"supportsVendorNamespaces": false,
"supportsPrivate": false,
"maxDepth": 3
}"#;
let info: DataTypeMetadataInfo = serde_json::from_str(json).unwrap();
assert_eq!(info.namespaces, vec!["photography"]);
assert_eq!(info.max_depth, Some(3));
// Validate namespace identifiers
assert!(is_valid_namespace("photography")); // registered
assert!(is_valid_namespace("acme.example.com")); // vendor domain
assert!(!is_valid_namespace("")); // emptyStructs§
- Data
Type Metadata Info - Per-data-type metadata capability advertisement (draft-ietf-jmap-metadata-04 §1.2.1).
- Metadata
Text Match - Value shape for the text-matching metadata filter conditions (draft-ietf-jmap-metadata-04 §3.6).
- With
Metadata - A per-type
FilterConditionextended with the six draft-ietf-jmap-metadata-04 §3.6 condition fields.
Constants§
- JMAP_
METADATA_ URI - The JMAP capability URI for the Metadata extension (draft-ietf-jmap-metadata-04 §1.2.1).
Functions§
- is_
registered_ namespace - Returns
trueifnameis a valid registered namespace identifier (draft-ietf-jmap-metadata-04 §2.1). - is_
valid_ namespace - Returns
trueifnameis a valid namespace identifier of either kind (registered name or vendor domain name). - is_
vendor_ namespace - Returns
trueifnameis a valid vendor (domain-name) namespace identifier (draft-ietf-jmap-metadata-04 §2.1).