Skip to content

Commit 6ee329e

Browse files
committed
Set appropriate titles in JSON schemas
1 parent 2b7ad67 commit 6ee329e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/frontend/serialization.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::middleware::PodId;
1212
use super::{MainPod, SignedPod, Value};
1313

1414
#[derive(Serialize, Deserialize, JsonSchema)]
15+
#[schemars(title = "SignedPod")]
1516
pub struct SignedPodHelper {
1617
entries: HashMap<String, Value>,
1718
proof: String,
@@ -54,6 +55,7 @@ impl From<SignedPod> for SignedPodHelper {
5455
}
5556

5657
#[derive(Serialize, Deserialize, JsonSchema)]
58+
#[schemars(title = "MainPod")]
5759
pub struct MainPodHelper {
5860
public_statements: Vec<Statement>,
5961
proof: String,
@@ -301,8 +303,13 @@ mod tests {
301303
#[test]
302304
fn test_schema() {
303305
let generator = SchemaSettings::draft07().into_generator();
304-
let schema = generator.into_root_schema_for::<MainPodHelper>();
306+
let mainpod_schema = generator.clone().into_root_schema_for::<MainPodHelper>();
307+
let signedpod_schema = generator.into_root_schema_for::<SignedPodHelper>();
305308

306-
println!("{}", serde_json::to_string(&schema).unwrap());
309+
println!("{}", serde_json::to_string_pretty(&mainpod_schema).unwrap());
310+
println!(
311+
"{}",
312+
serde_json::to_string_pretty(&signedpod_schema).unwrap()
313+
);
307314
}
308315
}

0 commit comments

Comments
 (0)