Skip to content

Commit

Permalink
serialize is_breaking into output on CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Mar 28, 2023
1 parent 57eb332 commit 249fee7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use clap::Parser;
use std::fs::File;
use std::path::PathBuf;

use clap::Parser;
use serde::Serialize;
use anyhow::Error;

/// Compare old and new schema, and print differences
Expand All @@ -14,6 +15,14 @@ struct Args {
rhs: PathBuf,
}

#[derive(Serialize)]
struct Change {
#[serde(flatten)]
inner: json_schema_diff::Change,
is_breaking: bool

}

fn main() -> Result<(), Error> {
let args = Args::parse();

Expand All @@ -23,6 +32,8 @@ fn main() -> Result<(), Error> {
let changes = json_schema_diff::diff(lhs, rhs)?;

for change in changes {
let is_breaking = change.change.is_breaking();
let change = Change { inner: change, is_breaking };
println!("{}", serde_json::to_string(&change)?);
}
Ok(())
Expand Down

0 comments on commit 249fee7

Please sign in to comment.