parse_sap_odata/property/
mod.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{
4    sap_annotations::property::SAPAnnotationsProperty,
5    utils::{de_str_to_bool, default_false, default_true},
6};
7
8#[cfg(feature = "parser")]
9pub mod metadata;
10
11pub mod property_ref;
12
13// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14/// Represents an `edm:Property` element
15#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Serialize, Deserialize)]
16#[serde(rename_all = "PascalCase")]
17pub struct Property {
18    #[serde(rename = "@Name")]
19    pub odata_name: String,
20    #[serde(rename = "@Type")]
21    pub edm_type: String,
22    #[serde(rename = "@Nullable", default = "default_true")]
23    pub nullable: bool,
24    #[serde(rename = "@MaxLength")]
25    pub max_length: Option<u16>,
26    #[serde(rename = "@Precision")]
27    pub precision: Option<u16>,
28    #[serde(rename = "@Scale")]
29    pub scale: Option<u16>,
30    #[serde(rename = "@ConcurrencyMode")]
31    pub concurrency_mode: Option<String>,
32    // Microsoft Annotations
33    #[serde(
34        rename = "@FC_KeepInContent",
35        deserialize_with = "de_str_to_bool",
36        default = "default_false"
37    )]
38    pub fc_keep_in_content: bool,
39    #[serde(rename = "@FC_TargetPath")]
40    pub fc_target_path: Option<String>,
41    // SAP Annotations
42    #[serde(flatten)]
43    pub sap_annotations: SAPAnnotationsProperty,
44    #[serde(skip, default)]
45    pub deserializer_fn: String,
46}
47
48// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49#[cfg(test)]
50pub mod unit_tests;