Skip to main content

check_against_schema

Function check_against_schema 

Source
pub fn check_against_schema(path: &Path, modelcard: &Path) -> Result<bool>
Expand description

Check a model card against a schema.

The function takes a path to a model card and a path to a schema and checks the model card against the schema.

§Arguments

  • path - A path to a model card or a directory containing a model card.
  • modelcard - A path to a schema file.

§Returns

The function returns a Result with a boolean indicating whether the model card is valid against the schema.

§Errors

The function will return an error if the model card is not valid against the schema.

§Example

use std::path::Path;
use modelcards::validate::check_against_schema;
 
let schema_path = Path::new("tests/schemas/my_schema.json");
let data_path = Path::new("tests/data/sample.json");
let result = check_against_schema(schema_path, data_path).unwrap();
assert_eq!(result, true);