forked from zed-industries/zed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
schema_generator
for generating JSON schemas (zed-industries#23991
) This PR adds a `schema_generator` crate that can be used to generate our various JSON schemas for publishing elsewhere. Currently it does the simplest thing possible and just prints the JSON schema to stdout. We can make this a but more robust later. I also removed the schema-printing facilities from the `theme_importer`, as they don't really make sense there. Release Notes: - N/A
- Loading branch information
1 parent
b6e54ae
commit e5bc048
Showing
7 changed files
with
76 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "schema_generator" | ||
version = "0.1.0" | ||
publish.workspace = true | ||
edition.workspace = true | ||
license = "GPL-3.0-or-later" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
anyhow.workspace = true | ||
clap = { workspace = true, features = ["derive"] } | ||
env_logger.workspace = true | ||
schemars = { workspace = true, features = ["indexmap2"] } | ||
serde.workspace = true | ||
serde_json.workspace = true | ||
theme.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../LICENSE-GPL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use anyhow::Result; | ||
use clap::Parser; | ||
use schemars::schema_for; | ||
use theme::{IconThemeFamilyContent, ThemeFamilyContent}; | ||
|
||
#[derive(Parser, Debug)] | ||
struct Args {} | ||
|
||
fn main() -> Result<()> { | ||
env_logger::init(); | ||
|
||
let _args = Args::parse(); | ||
|
||
let theme_family_schema = schema_for!(ThemeFamilyContent); | ||
println!("Theme Schema:"); | ||
println!("{}", serde_json::to_string_pretty(&theme_family_schema)?); | ||
|
||
let icon_theme_family_schema = schema_for!(IconThemeFamilyContent); | ||
println!("Icon Theme Schema:"); | ||
println!( | ||
"{}", | ||
serde_json::to_string_pretty(&icon_theme_family_schema)? | ||
); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters