Add JsonSchema to container style and fix compile errors

This commit is contained in:
Mikayla Maki
2023-06-19 11:31:17 -07:00
parent ac42522987
commit 193ad64d18
5 changed files with 23 additions and 26 deletions
+13 -4
View File
@@ -3,9 +3,8 @@ use anyhow::{Context, Result};
use collections::BTreeMap;
use gpui::{keymap_matcher::Binding, AppContext};
use schemars::{
gen::SchemaSettings,
schema::{InstanceType, Schema, SchemaObject, SingleOrVec, SubschemaValidation},
JsonSchema,
gen::{SchemaGenerator, SchemaSettings},
schema::{InstanceType, Schema, SchemaObject, SingleOrVec, SubschemaValidation}, JsonSchema,
};
use serde::Deserialize;
use serde_json::{value::RawValue, Value};
@@ -22,10 +21,20 @@ pub struct KeymapBlock {
bindings: BTreeMap<String, KeymapAction>,
}
#[derive(Deserialize, Default, Clone, JsonSchema)]
#[derive(Deserialize, Default, Clone)]
#[serde(transparent)]
pub struct KeymapAction(Box<RawValue>);
impl JsonSchema for KeymapAction {
fn schema_name() -> String {
"KeymapAction".into()
}
fn json_schema(_: &mut SchemaGenerator) -> Schema {
Schema::Bool(true)
}
}
#[derive(Deserialize)]
struct ActionWithData(Box<str>, Box<RawValue>);