Skip to main content

undocumented

.undocumented() takes the schemas of one manual registration out of the document and lifts its JsonSchema demand.

Under the asyncapi feature a subscriber(..) registration is documented by default. Mounting it demands JsonSchema of its message types, and a type without the derive is a compile error at the mount. undocumented is the exit for one registration, such as one whose message type comes from a crate that ships no schema. The registration stays in the document: its channel and its operation remain, and its messages carry no payload schema. messages_without_schema lists those messages. The step is written once; a second one does not compile. On the attribute path a type without the derive already mounts and contributes no schema, so the attribute has no such step. Without the asyncapi feature a registration demands nothing. The example runs with cargo test --example asyncapi_schemas --features macros,memory,asyncapi.

Example​

/// An audit record another team publishes, with no schema shipped for it.
#[derive(Debug, Deserialize)]
struct AuditRecord {
action: String,
}

#[subscriber("audit")]
async fn record(entry: &AuditRecord) -> HandlerOutcome {
tracing::info!(action = %entry.action, "audited");
HandlerOutcome::ack()
}