Skip to main content

get_property

Function get_property 

Source
pub fn get_property<'a>(schema: &'a Value, field: &str) -> Option<&'a Value>
Expand description

Get the property schema for a specific field.

let schema = serde_json::json!({
    "type": "object",
    "properties": { "name": { "type": "string", "minLength": 1 } }
});
let name_schema = vld_openapi::validator::get_property(&schema, "name").unwrap();
assert_eq!(name_schema["type"], "string");