Skip to main content

Crate jmap_metadata_types

Crate jmap_metadata_types 

Source
Expand description

JMAP Object Metadata extension data types.

Implements the data types defined in draft-ietf-jmap-metadata-02. Types only — no method handlers, no async, no network I/O.

§Architecture change from -01 to -02

draft-ietf-jmap-metadata-02 eliminates the standalone Metadata object type entirely. Instead, each opted-in 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:

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(""));                 // empty

Re-exports§

pub use capability::DataTypeMetadataInfo;
pub use capability::JMAP_METADATA_URI;
pub use filter::MetadataTextMatch;
pub use namespace::is_registered_namespace;
pub use namespace::is_valid_namespace;
pub use namespace::is_vendor_namespace;

Modules§

capability
draft-ietf-jmap-metadata-02 §1.2.1 — capability registration and per-data-type metadata info.
filter
draft-ietf-jmap-metadata-02 §3.5 — metadata filter condition types.
namespace
draft-ietf-jmap-metadata-02 §2.1 — namespace identifier validation.