jsonref dereferences JSONSchema $ref
attributes and creates a new dereferenced schema.
Dereferencing is normally done by a JSONSchema validator in the process of validation, but it is sometimes useful to do this independent of the validator for tasks like:
Example: ``` use serde_json::json; use jsonref::JsonRef;
let mut simple_example = json!( {"properties": {"prop1": {"title": "name"}, "prop2": {"$ref": "#/properties/prop1"}} } );
let mut jsonref = JsonRef::new();
jsonref.derefvalue(&mut simpleexample).unwrap();
let dereffedexpected = json!( {"properties": {"prop1": {"title": "name"}, "prop2": {"title": "name"}} } ); asserteq!(simpleexample, dereffedexpected) ```
Note: If the JSONSchema has recursive $ref
only the first recursion will happen.
This is to stop an infinate loop.