feat(config): reduce noise in jsonschema output

This commit is contained in:
LGUG2Z
2024-01-18 16:33:31 -08:00
committed by جاد
parent 596884e9fd
commit 731a4465f1
5 changed files with 631 additions and 496 deletions

View File

@@ -50,3 +50,7 @@ deadlock $RUST_LOG="trace":
docgen:
komorebic docgen
Get-ChildItem -Path "docs/cli" -Recurse -File | ForEach-Object { (Get-Content $_.FullName) -replace 'Usage: ', 'Usage: komorebic.exe ' | Set-Content $_.FullName }
schemagen:
komorebic static-config-schema > schema.json
generate-schema-doc .\schema.json --config template_name=js_offline --config minify=false .\static-config-docs\

View File

@@ -18,6 +18,7 @@ use color_eyre::Result;
use miow::pipe::connect;
use net2::TcpStreamExt;
use parking_lot::Mutex;
use schemars::gen::SchemaSettings;
use schemars::schema_for;
use uds_windows::UnixStream;
@@ -1311,7 +1312,14 @@ impl WindowManager {
}
}
SocketMessage::StaticConfigSchema => {
let socket_message = schema_for!(StaticConfig);
let settings = SchemaSettings::default().with(|s| {
s.option_nullable = false;
s.option_add_null_type = false;
s.inline_subschemas = true;
});
let gen = settings.into_generator();
let socket_message = gen.into_root_schema_for::<StaticConfig>();
let schema = serde_json::to_string_pretty(&socket_message)?;
let socket = DATA_DIR.join("komorebic.sock");

View File

@@ -231,6 +231,7 @@ impl From<&Monitor> for MonitorConfig {
}
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
/// The `komorebi.json` static configuration file reference for `v0.1.20`
pub struct StaticConfig {
/// Dimensions of Windows' own invisible borders; don't set these yourself unless you are told to
#[serde(skip_serializing_if = "Option::is_none")]
@@ -257,10 +258,12 @@ pub struct StaticConfig {
#[serde(skip_serializing_if = "Option::is_none")]
pub app_specific_configuration_path: Option<PathBuf>,
/// DEPRECATED from v0.1.19: use active_window_border_width instead
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(skip)]
#[serde(skip_serializing)]
pub border_width: Option<i32>,
/// DEPRECATED from v0.1.19: use active_window_border_offset instead
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(skip)]
#[serde(skip_serializing)]
pub border_offset: Option<Rect>,
/// Width of the active window border (default: 20)
#[serde(skip_serializing_if = "Option::is_none")]
@@ -283,8 +286,9 @@ pub struct StaticConfig {
/// Monitor and workspace configurations
#[serde(skip_serializing_if = "Option::is_none")]
pub monitors: Option<Vec<MonitorConfig>>,
/// Always send the ALT key when using focus commands (default: false)
#[serde(skip_serializing_if = "Option::is_none")]
/// DEPRECATED from v0.1.20: no longer required
#[schemars(skip)]
#[serde(skip_serializing)]
pub alt_focus_hack: Option<bool>,
/// Which Windows signal to use when hiding windows (default: minimize)
#[serde(skip_serializing_if = "Option::is_none")]

View File

@@ -50,7 +50,8 @@ nav:
- Getting started:
- Installation: installation.md
- Example configurations: example-configurations.md
- Configuration reference: https://komorebi.lgug2z.com/schema
- Configuration:
- JSONSchema reference: https://komorebi.lgug2z.com/schema
- CLI reference:
- cli/quickstart.md
- cli/start.md

File diff suppressed because it is too large Load Diff