parse_sap_odata/edmx/data_services/schema/
mod.rs

1use parse_sap_atom_feed::atom::link::AtomLink;
2use serde::{Deserialize, Serialize};
3
4use association::Association;
5use complex_type::ComplexType;
6use entity_container::EntityContainer;
7use entity_type::EntityType;
8
9use crate::{
10    oasis::annotations::Annotations,
11    sap_annotations::schema::SAPAnnotationsSchema,
12    xml::{default_xml_language, default_xml_namespace},
13};
14
15pub mod association;
16pub mod complex_type;
17pub mod entity_container;
18pub mod entity_type;
19#[cfg(feature = "parser")]
20pub mod metadata;
21
22// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23/// Represents a `<Schema>` tag
24///
25/// # Child Nodes
26///
27/// `1:n EntityType`<br>
28/// `0:n Association`<br>
29/// `0:n ComplexType`<br>
30/// `1:1 EntityContainer`
31#[derive(Debug, Serialize, Deserialize)]
32pub struct Schema {
33    #[serde(rename = "@xmlns", default = "default_xml_namespace")]
34    pub xml_namespace: String,
35    #[serde(rename = "@Namespace", default)]
36    pub namespace: String,
37    #[serde(rename = "@xml:lang", default = "default_xml_language")]
38    pub xml_lang: String,
39    #[serde(flatten)]
40    pub sap_annotations: SAPAnnotationsSchema,
41    #[serde(rename = "EntityType", default)]
42    pub entity_types: Vec<EntityType>,
43    #[serde(rename = "ComplexType", default)]
44    pub complex_types: Option<Vec<ComplexType>>,
45    #[serde(rename = "Association", default)]
46    pub associations: Vec<Association>,
47    #[serde(rename = "EntityContainer", default)]
48    pub entity_container: Option<EntityContainer>,
49    #[serde(rename = "Annotations", default)]
50    pub annotation_list: Option<Vec<Annotations>>,
51    // Appears in the original XML as the tagname "atom:link"
52    #[serde(rename = "link")]
53    pub atom_links: Vec<AtomLink>,
54}