fn validate(&self) -> Result<()> {
        let schema = from_str(Self::get_schema())?;
        let mut scope = json_schema::Scope::new();

        // Add the schema including all the common definitions.
        let common_schema = from_str(include_str!("../common.json"))?;
        scope.compile(common_schema, true).map_err(Error::SchemaInvalid)?;

        let validator = scope.compile_and_return(schema, true).map_err(Error::SchemaInvalid)?;
        let value = to_value(self)?;
        let result = validator.validate(&value);
        if !result.is_valid() {
            let mut error_messages: Vec<String> =
                result.errors.iter().map(format_valico_error).collect();
            error_messages.sort_unstable();
            return Err(Error::JsonFileInvalid { errors: error_messages.join(", ") }.into());
        }
        Ok(())
    }
/// Checks whether the object satisfies its associated JSON schema.
Checks whether the object satisfies its associated JSON schema.
Checks whether the object satisfies its associated JSON schema .
fn validate(&self) -> Result<()> {
        let schema = from_str(Self::get_schema())?;
        let mut scope = json_schema::Scope::new();
        // Add the schema including all the common definitions.
        let common_schema = from_str(include_str!("../common.json"))?;
        scope.compile(common_schema, true).map_err(Error::SchemaInvalid)?;
        let validator = scope.compile_and_return(schema, true).map_err(Error::SchemaInvalid)?;
        let value = to_value(self)?;
        let result = validator.validate(&value);
        if !result.is_valid() {
            let mut error_messages: Vec<String> =
                result.errors.iter().map(format_valico_error).collect();
            error_messages.sort_unstable();
            return Err(Error::JsonFileInvalid { errors: error_messages.join(", ") }.into());
        }
        Ok(())
    }
fn validate ( & self ) -> Result < ( ) > { let schema = from_str ( Self :: get_schema ( ) ) ? ; let mut scope = json_schema :: Scope :: new ( ) ; // Add the schema including all the common definitions. let common_schema = from_str ( include_str ! ( " " ) ) ? ; scope . compile ( common_schema , true ) . map_err ( Error :: SchemaInvalid ) ? ; let validator = scope . compile_and_return ( schema , true ) . map_err ( Error :: SchemaInvalid ) ? ; let value = to_value ( self ) ? ; let result = validator . validate ( & value ) ; if ! result . is_valid ( ) { let mut error_messages : Vec < String > = result . errors . iter ( ) . map ( format_valico_error ) . collect ( ) ; error_messages . sort_unstable ( ) ; return Err ( Error :: JsonFileInvalid { errors : error_messages . join ( " " ) } . into ( ) ) ; } Ok ( ( ) ) }
Checks whether the object satisfies its associated JSON schema.
Checks whether the object satisfies its associated JSON schema .
&self
&self