Skip to content

Commit

Permalink
derive Error for ValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Jul 25, 2024
1 parent 013cc6b commit 20e9e86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dsp-meta/src/api/convert/serde/json_schema_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fs::File;
use std::path::Path;

use serde_json::Value;
use thiserror::Error;
use valico::json_schema::schema::ScopedSchema;
use valico::json_schema::{Scope, ValidationState};

Expand All @@ -23,10 +24,13 @@ impl SchemaVersion {
}

pub type Result<T> = core::result::Result<T, ValidationError>;
#[derive(Debug)]
#[derive(Debug, Error )]
pub enum ValidationError {
#[error("File not loaded: {0}")]
FileNotLoaded(std::io::Error),
#[error("Schema is invalid: {0}")]
SchemaError(valico::json_schema::schema::SchemaError),
#[error("Error parsing file as json: {0}")]
NotAJsonFile(serde_json::Error),
}

Expand Down

0 comments on commit 20e9e86

Please sign in to comment.