feat: fix minor bugs

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-08-24 14:55:26 +02:00
parent c2b7e44ea3
commit 1ba6cf79c0
12 changed files with 405 additions and 21 deletions

View File

@@ -0,0 +1,30 @@
use nickel::NickelSchemaValidator;
use crate::{
plan::{RawPlan, RawPlanSchema},
project::RawProject,
};
mod nickel;
pub struct SchemaValidator {}
impl SchemaValidator {
pub fn new() -> Self {
Self {}
}
pub fn validate(&self, plan: &RawPlan, project: &RawProject) -> anyhow::Result<Option<()>> {
let schema = match &plan.config.plan.schema {
Some(schema) => schema,
None => return Ok(None),
};
match schema {
RawPlanSchema::Nickel { nickel } => Ok(Some(NickelSchemaValidator::validate(
plan, project, nickel,
)?)),
RawPlanSchema::JsonSchema { jsonschema } => todo!("jsonschema not implemented yet"),
}
}
}