Skip to content

Commit fe670f6

Browse files
committed
reticulating
1 parent 1241aa1 commit fe670f6

File tree

5 files changed

+55
-1
lines changed

5 files changed

+55
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nexus/alerts/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ omicron-uuid-kinds.workspace = true
1616
nexus-auth.workspace = true
1717
schemars.workspace = true
1818
serde.workspace = true
19+
serde_json.workspace = true
1920

2021
omicron-workspace-hack.workspace = true
2122

nexus/alerts/src/lib.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,54 @@ impl JsonSchema for AlertSchemaRegistry {
119119
// }
120120
}
121121
}
122+
123+
// impl JsonSchema for SchemaVersions {
124+
// fn schema_name() -> String {
125+
// self.name.clone()
126+
// }
127+
128+
// fn json_schema(generator: &mut schemars::SchemaGenerator) -> Schema {
129+
// todo!("eliza figure this out")
130+
// // for (class, alert) in self.schemas {
131+
132+
// // }
133+
// }
134+
// }
135+
136+
// use schemars::schema::{Metadata, Schema, SchemaObject, SubschemaValidation};
137+
// use serde_json::json;
138+
139+
// /// Insert another level of schema indirection in order to provide an
140+
// /// additional title for a subschema. This allows generators to infer a better
141+
// /// variant name for an "untagged" enum.
142+
// pub(crate) fn label_schema(label: &str, schema: Schema) -> Schema {
143+
// SchemaObject {
144+
// metadata: Some(
145+
// Metadata { title: Some(label.to_string()), ..Default::default() }
146+
// .into(),
147+
// ),
148+
// subschemas: Some(
149+
// SubschemaValidation {
150+
// all_of: Some(vec![schema]),
151+
// ..Default::default()
152+
// }
153+
// .into(),
154+
// ),
155+
// ..Default::default()
156+
// }
157+
// .into()
158+
// }
159+
160+
#[cfg(test)]
161+
mod tests {
162+
use super::*;
163+
164+
#[test]
165+
fn alert_class_schema() {
166+
let mut generator = schemars::SchemaGenerator::default();
167+
168+
let _ = generator.subschema_for::<AlertClass>();
169+
let root = generator.into_root_schema_for::<()>();
170+
eprintln!("{}", serde_json::to_string_pretty(&root).unwrap())
171+
}
172+
}

nexus/db-model/src/alert_class.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl_enum_type!(
2121
AsExpression,
2222
FromSqlRow,
2323
strum::VariantArray,
24+
schemars::JsonSchema,
2425
)]
2526
pub enum AlertClass;
2627

nexus/tests/integration_tests/webhooks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ async fn test_multiple_receivers(cptestctx: &ControlPlaneTestContext) {
821821
.alert_publish(
822822
&opctx,
823823
baz_alert_id,
824-
test_events::FooBaz { hello: "san francisco" },
824+
test_alerts::FooBaz { hello: "san francisco" },
825825
)
826826
.await
827827
.expect("event should be published successfully");

0 commit comments

Comments
 (0)