1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-05 12:31:04 +02:00

feat(config): json schema support

This PR includes the necessary code changes, CI changes and documentation to generate and deploy a full JSON schema for each release and the master branch, which can be used within config files for autocomplete and type checking.
This commit is contained in:
Jake Stanger 2024-05-10 22:40:00 +01:00
parent a47ef0c763
commit 36d724f148
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
36 changed files with 230 additions and 15 deletions

View file

@ -14,6 +14,7 @@ use tracing::{debug, error, trace, warn};
#[derive(Debug, Deserialize, Clone)]
#[serde(untagged)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum ScriptInput {
String(String),
Struct(Script),
@ -21,6 +22,7 @@ pub enum ScriptInput {
#[derive(Debug, Deserialize, Clone, Copy, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum ScriptMode {
Poll,
Watch,
@ -75,6 +77,7 @@ impl ScriptMode {
}
#[derive(Debug, Deserialize, Clone)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct Script {
#[serde(default = "ScriptMode::default")]
pub(crate) mode: ScriptMode,