Skip to content

Commit

Permalink
Cover serde_json RawValue type by schemars
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-biel committed Oct 13, 2022
1 parent 5268080 commit f5a5263
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions schemars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ uuid = ["uuid08"]
arrayvec = ["arrayvec05"]
indexmap1 = ["indexmap"]

raw_value = ["serde_json/raw_value"]

ui_test = []

[[test]]
Expand Down
13 changes: 13 additions & 0 deletions schemars/src/json_schema_impls/serdejson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,16 @@ impl JsonSchema for Number {
.into()
}
}

#[cfg(feature = "raw_value")]
impl JsonSchema for serde_json::value::RawValue {
no_ref_schema!();

fn schema_name() -> String {
"AnyValue".to_owned()
}

fn json_schema(_: &mut SchemaGenerator) -> Schema {
Schema::Bool(true)
}
}

0 comments on commit f5a5263

Please sign in to comment.