parse_sap_odata/edmx/data_services/schema/entity_container/
mod.rs

1use serde::{Deserialize, Serialize};
2
3use association_set::AssociationSet;
4use entity_set::EntitySet;
5use function_import::FunctionImport;
6
7use crate::{
8    sap_annotations::entity_container::SAPAnnotationsEntityContainer,
9    utils::{de_str_to_bool, default_false},
10};
11
12pub mod association_set;
13pub mod entity_set;
14pub mod function_import;
15#[cfg(feature = "parser")]
16pub mod metadata;
17
18// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19/// Represents an `<EntityContainer>` tag
20///
21/// # Child Nodes
22/// `1:n EntitySet`<br>
23/// `1:n AssociationSet`<br>
24/// `0:n FunctionImport`
25#[derive(Debug, Serialize, Deserialize)]
26#[serde(rename_all = "PascalCase")]
27pub struct EntityContainer {
28    #[serde(rename = "@Name")]
29    pub name: String,
30    #[serde(
31        rename = "@IsDefaultEntityContainer",
32        deserialize_with = "de_str_to_bool",
33        default = "default_false"
34    )]
35    pub is_default_entity_container: bool,
36    #[serde(flatten)]
37    pub sap_annotations: SAPAnnotationsEntityContainer,
38    #[serde(rename = "EntitySet", default)]
39    pub entity_sets: Vec<EntitySet>,
40    #[serde(rename = "AssociationSet", default)]
41    pub association_sets: Vec<AssociationSet>,
42    #[serde(rename = "FunctionImport", default)]
43    pub function_imports: Option<Vec<FunctionImport>>,
44}
45
46// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47#[cfg(test)]
48pub mod unit_tests;