mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-20 09:01:56 +00:00
feat: expand api snapshots and schema tooling
This commit is contained in:
parent
ee014b0838
commit
011ca27287
72 changed files with 29480 additions and 1081 deletions
12
server/packages/universal-schema-gen/Cargo.toml
Normal file
12
server/packages/universal-schema-gen/Cargo.toml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "sandbox-agent-universal-schema-gen"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
build = "build.rs"
|
||||
|
||||
[build-dependencies]
|
||||
sandbox-agent-universal-agent-schema.workspace = true
|
||||
schemars.workspace = true
|
||||
serde_json.workspace = true
|
||||
26
server/packages/universal-schema-gen/build.rs
Normal file
26
server/packages/universal-schema-gen/build.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use std::{fs, path::Path};
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=../universal-agent-schema/src/lib.rs");
|
||||
|
||||
let schema = schemars::schema_for!(sandbox_agent_universal_agent_schema::UniversalEvent);
|
||||
|
||||
let workspace_root = std::env::var("CARGO_MANIFEST_DIR")
|
||||
.map(|dir| {
|
||||
Path::new(&dir)
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.to_path_buf()
|
||||
})
|
||||
.unwrap();
|
||||
let out_dir = workspace_root.join("spec");
|
||||
fs::create_dir_all(&out_dir).unwrap();
|
||||
|
||||
let json = serde_json::to_string_pretty(&schema).expect("Failed to serialize JSON schema");
|
||||
fs::write(out_dir.join("universal-schema.json"), json)
|
||||
.expect("Failed to write universal-schema.json");
|
||||
}
|
||||
2
server/packages/universal-schema-gen/src/lib.rs
Normal file
2
server/packages/universal-schema-gen/src/lib.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// This crate exists only to trigger the build.rs script
|
||||
// which generates the universal JSON schema at build time.
|
||||
Loading…
Add table
Add a link
Reference in a new issue