Skip to main content

valico/json_schema/keywords/
const_.rs

1use serde_json::Value;
2
3use super::super::schema;
4use super::super::validators;
5
6#[allow(missing_copy_implementations)]
7pub struct Const;
8impl super::Keyword for Const {
9    fn compile(&self, def: &Value, _ctx: &schema::WalkContext) -> super::KeywordResult {
10        let const_ = keyword_key_exists!(def, "const");
11
12        Ok(Some(Box::new(validators::Const {
13            item: const_.clone(),
14        })))
15    }
16}