openconfiguration 1.5.0

OpenConfiguration (OC) is a modular, efficient and flexible approach for the uni-directional exchange of visual e-commerce configurations.
Documentation
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::impl_visitable_noop;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "schema", schemars(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct CatalogEntry {
    pub entry_type: CatalogEntryType,
    /// Id of the entry. Needed if catalog processing is done server side.
    pub entry_id: String,
    /// Localized entry text. Key is ISO 639-1 language code.
    #[serde(deserialize_with = "crate::utils::deserialize_map_without_null_values")]
    pub entry_text: HashMap<String, Vec<String>>,
    /// For type Article, the native id of the article to be created.
    pub article_id: String,
    /// For type Folder, the contained entries: folders and/or articles
    pub entries: Vec<CatalogEntry>,
}

impl_visitable_noop!(CatalogEntry);

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum CatalogEntryType {
    Folder,
    Article,
}