Skip to main content

validate_against_schema_str

Function validate_against_schema_str 

Source
pub fn validate_against_schema_str(yaml: &str, schema_yaml: &str) -> Result<()>
Expand description

Validate the YAML text in yaml against the JSON Schema document in schema_yaml. Convenience wrapper around validate_against_schema — parses both inputs and forwards.

§Errors

As validate_against_schema, plus YAML parse errors for either input.

§Examples

use noyalib::validate_against_schema_str;

let schema = "type: object\nrequired: [port]\n";
let yaml = "port: 8080\n";
validate_against_schema_str(yaml, schema).unwrap();