diff --git a/v3/Cargo.lock b/v3/Cargo.lock index d3084831440..2b4f01ffc7d 100644 --- a/v3/Cargo.lock +++ b/v3/Cargo.lock @@ -1798,6 +1798,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metadata-schema-generator" +version = "0.1.0" +dependencies = [ + "open-dds", + "schemars", + "serde_json", +] + [[package]] name = "mime" version = "0.3.17" diff --git a/v3/crates/metadata-schema-generator/Cargo.toml b/v3/crates/metadata-schema-generator/Cargo.toml new file mode 100644 index 00000000000..8cbe72a554c --- /dev/null +++ b/v3/crates/metadata-schema-generator/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "metadata-schema-generator" +version.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +open-dds = { path = "../open-dds" } +serde_json = "1.0.92" +schemars = { version = "0.8.12", features = ["smol_str"] } diff --git a/v3/crates/metadata-schema-generator/README.md b/v3/crates/metadata-schema-generator/README.md new file mode 100644 index 00000000000..619fb8a1d8d --- /dev/null +++ b/v3/crates/metadata-schema-generator/README.md @@ -0,0 +1,9 @@ +# Metadata Schema Generator + +When we make changes to the metadata schema, we need to regenerate the +goldenfile to make the tests happy. We can use the following command to get the +schema immediately for whatever reason: + +```bash +$ cargo run --bin metadata-schema-generator +``` diff --git a/v3/crates/metadata-schema-generator/src/main.rs b/v3/crates/metadata-schema-generator/src/main.rs new file mode 100644 index 00000000000..8bc54122f7f --- /dev/null +++ b/v3/crates/metadata-schema-generator/src/main.rs @@ -0,0 +1,8 @@ +use open_dds::traits::gen_root_schema_for; +use open_dds::Metadata; +use schemars::gen::SchemaGenerator; + +fn main() { + let schema = gen_root_schema_for::(&mut SchemaGenerator::default()); + println!("{}", serde_json::to_string_pretty(&schema).unwrap()); +}