Stranger6667/jsonschema-rs

Using $ref resolver outside validation

Opened this issue · 0 comments

Is there currently functionality to transform a JSON Schema with $ref properties into a dereferenced JSON Schema (with sub-schema containing $ref properties replaced by the referenced schema)? e.g.

let mut schema = json!({
    "properties": {
        "foo": {"title": "Foo"},
        "bar": {"$ref": "#/properties/foo"}
    }
});

JSONSchema::dereference(&mut schema);

assert_eq!(schema, json!({
    "properties": {
        "foo": {"title": "Foo"},
        "bar": {"title": "Foo"}
    }
}))