Skip to main content

objectiveai_sdk/cli/output/notification/
notification.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4/// Wrapper that nests the notification payload one level deeper under a
5/// `value` field. Required because [`super::super::Output`] uses
6/// `#[serde(tag = "type")]` — if we let `T` flatten directly into the
7/// outer JSON object, any `T` carrying its own `"type"` field (e.g. a
8/// JSON Schema document with `"type": "object"`) would collide with
9/// the discriminator.
10///
11/// Wire (in combination with `Output::Notification`):
12/// `{"type":"notification","value":<T>}`.
13#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
14#[schemars(rename = "cli.output.notification.Notification.{T}")]
15pub struct Notification<T> {
16    pub value: T,
17}