docs(schema): add cmd to generate notification schema

This commit is contained in:
LGUG2Z committed 2025-09-24 18:27:04 -07:00
1 parent 8a17e0ad00
commit 20c3bbd9a1
4 files changed
+20 -2

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
pub use komorebi::DATA_DIR;
pub use komorebi::Notification;
pub use komorebi::core::ApplicationIdentifier;
pub use komorebi::core::MoveBehaviour;
pub use komorebi::core::OperationBehaviour;
+1 -1
View File
@@ -403,7 +403,7 @@ pub enum SocketMessage {
// AddSubscriberPipe(String),
// RemoveSubscriberPipe(String),
ApplicationSpecificConfigurationSchema,
// NotificationSchema,
NotificationSchema,
SocketSchema,
StaticConfigSchema,
// GenerateStaticConfig,
+9
View File
@@ -1422,6 +1422,15 @@ impl WindowManager {
reply.write_all(schema.as_bytes())?;
}
}
SocketMessage::NotificationSchema => {
#[cfg(feature = "schemars")]
{
let notification = schemars::schema_for!(Notification);
let schema = serde_json::to_string_pretty(&notification)?;
reply.write_all(schema.as_bytes())?;
}
}
SocketMessage::SocketSchema => {
#[cfg(feature = "schemars")]
{
+9 -1
View File
@@ -1087,7 +1087,7 @@ enum SubCommand {
#[clap(alias = "asc-schema")]
ApplicationSpecificConfigurationSchema,
/// Generate a JSON Schema of subscription notifications
// NotificationSchema,
NotificationSchema,
/// Generate a JSON Schema of socket messages
SocketSchema,
/// Generate a JSON Schema of the static configuration file
@@ -1710,6 +1710,14 @@ fn main() -> eyre::Result<()> {
println!("{schema}");
}
}
SubCommand::NotificationSchema => {
#[cfg(feature = "schemars")]
{
let notification = schemars::schema_for!(komorebi_client::Notification);
let schema = serde_json::to_string_pretty(&notification)?;
println!("{schema}");
}
}
SubCommand::SocketSchema => {
#[cfg(feature = "schemars")]
{