diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 51fd64ce..c641299c 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -56,6 +56,8 @@ uuid = ["uuid08"] arrayvec = ["arrayvec05"] indexmap1 = ["indexmap"] +raw_value = ["serde_json/raw_value"] + ui_test = [] [[test]] diff --git a/schemars/src/json_schema_impls/serdejson.rs b/schemars/src/json_schema_impls/serdejson.rs index d0cceff6..df6ad497 100644 --- a/schemars/src/json_schema_impls/serdejson.rs +++ b/schemars/src/json_schema_impls/serdejson.rs @@ -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) + } +}